Commit 53e8c61
authored
fix(blocks): release isBlockMoving when a drag ends any other way (#8363)
moveBlockRelative and moveBlockRelativeBatched raise blocks.isBlockMoving,
and block.js calls moveBlockRelativeBatched on every pressmove before any
threshold is applied. The only place that lowered the flag was the tail of
blockMoved(), which block.js reaches only when a drag passed the 5px
movement threshold, ended, and finished away from the trashcan.
Two everyday actions therefore latched the flag on for the rest of the
session. Pressing a block and moving less than 5px runs the move but
leaves `moved` false, so the whole branch that would call blockMoved is
skipped. Dragging a stack onto the trashcan runs sendStackToTrash instead,
which never touches the flag. blockMoved's own two guard clauses returned
early past the clear as well.
selection-controller gates the entire drag-select animation frame on
!isBlockMoving, and drawSelectionArea, selectBlocksInDragArea and
setSelectedBlocks are reachable from nowhere else, so rubber-band
selection silently stopped working with no error and no visible cause.
It only recovered if the user happened to perform a normal drag that ran
blockMoved to completion.
Lower the flag in clearCachedDragGroup() instead. Both the mouseout and
pressup handlers call that unconditionally once a drag is over, whichever
way it ended, so it covers the trashcan and sub-threshold paths together.
The two guard clauses in blockMoved also clear it, since blockMoved is
additionally reachable from the keyboard controller and the palette, which
do not run the drag teardown.
Four of the seven added tests fail without this change. The other three
assert that the flag is still raised on a move and still lowered by a
completed blockMoved, so the behaviour cannot be "fixed" by simply
dropping the flag.
Signed-off-by: netram75 <netram.24bcs10329@sst.scaler.com>1 parent dbaf3bc commit 53e8c61
2 files changed
Lines changed: 91 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1427 | 1427 | | |
1428 | 1428 | | |
1429 | 1429 | | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
1430 | 1512 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
103 | 110 | | |
104 | 111 | | |
105 | 112 | | |
| |||
258 | 265 | | |
259 | 266 | | |
260 | 267 | | |
| 268 | + | |
261 | 269 | | |
262 | 270 | | |
263 | 271 | | |
| |||
292 | 300 | | |
293 | 301 | | |
294 | 302 | | |
| 303 | + | |
295 | 304 | | |
296 | 305 | | |
297 | 306 | | |
| |||
0 commit comments