@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix an issue where drag positions could get out of sync after scrolling

Summary:
Ref T5240. Currently, we calculate drag positions assuming the "ghost" element is not present (it isn't, usually), then adjust them while dragging to account for the ghost.

However, this fails after scrolling: we dirty the cache, but the ghost //is// present. We continue adjusting for it, but essentially double-adjust. This leads to scroll positions being about 80-ish px off from where they should be.

Test Plan:
- Begin dragging a task in a long task list.
- While dragging, use mousewheel to scroll to the bottom of the list.
- Drag task downward through the list.
- Before fix: ghost is off by, like, an inch or so.
- After fix: ghost position is accurate to cursor position.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T5240

Differential Revision: https://secure.phabricator.com/D15157

+18 -28
+11 -11
resources/celerity/map.php
··· 8 8 return array( 9 9 'names' => array( 10 10 'core.pkg.css' => '0f87bfe0', 11 - 'core.pkg.js' => 'a79eed25', 11 + 'core.pkg.js' => 'bf947f93', 12 12 'darkconsole.pkg.js' => 'e7393ebb', 13 13 'differential.pkg.css' => '2de124c9', 14 14 'differential.pkg.js' => '5c2ba922', ··· 446 446 'rsrc/js/application/uiexample/notification-example.js' => '8ce821c5', 447 447 'rsrc/js/core/Busy.js' => '59a7976a', 448 448 'rsrc/js/core/DragAndDropFileUpload.js' => 'ad10aeac', 449 - 'rsrc/js/core/DraggableList.js' => 'a16ec1c6', 449 + 'rsrc/js/core/DraggableList.js' => '255d85da', 450 450 'rsrc/js/core/FileUpload.js' => '477359c8', 451 451 'rsrc/js/core/Hovercard.js' => 'c6f720ff', 452 452 'rsrc/js/core/KeyboardShortcut.js' => '1ae869f2', ··· 741 741 'phabricator-countdown-css' => 'e7544472', 742 742 'phabricator-dashboard-css' => 'eb458607', 743 743 'phabricator-drag-and-drop-file-upload' => 'ad10aeac', 744 - 'phabricator-draggable-list' => 'a16ec1c6', 744 + 'phabricator-draggable-list' => '255d85da', 745 745 'phabricator-fatal-config-template-css' => '8e6c6fcd', 746 746 'phabricator-feed-css' => 'ecd4ec57', 747 747 'phabricator-file-upload' => '477359c8', ··· 1021 1021 'phabricator-drag-and-drop-file-upload', 1022 1022 'phabricator-draggable-list', 1023 1023 ), 1024 + '255d85da' => array( 1025 + 'javelin-install', 1026 + 'javelin-dom', 1027 + 'javelin-stratcom', 1028 + 'javelin-util', 1029 + 'javelin-vector', 1030 + 'javelin-magical-init', 1031 + ), 1024 1032 '2926fff2' => array( 1025 1033 'javelin-behavior', 1026 1034 'javelin-dom', ··· 1586 1594 'javelin-install', 1587 1595 'javelin-dom', 1588 1596 'javelin-reactor-dom', 1589 - ), 1590 - 'a16ec1c6' => array( 1591 - 'javelin-install', 1592 - 'javelin-dom', 1593 - 'javelin-stratcom', 1594 - 'javelin-util', 1595 - 'javelin-vector', 1596 - 'javelin-magical-init', 1597 1597 ), 1598 1598 'a2828756' => array( 1599 1599 'javelin-dom',
+7 -17
webroot/rsrc/js/core/DraggableList.js
··· 290 290 } 291 291 292 292 this._target = false; 293 + 294 + // Clear the target position cache, since adding or removing ghosts 295 + // changes element positions. 296 + this._dirtyTargetCache(); 297 + 293 298 return this; 294 299 }, 295 300 ··· 297 302 var ghost = this.getGhostNode(); 298 303 var targets = this._getTargets(); 299 304 var dragging = this._dragging; 300 - 301 - var adjust_h = JX.Vector.getDim(ghost).y; 302 - var adjust_y = JX.$V(ghost).y; 303 305 304 306 // Find the node we're dragging the object underneath. This is the first 305 307 // node in the list that's above the cursor. If that node is the node ··· 314 316 var cur_target = null; 315 317 var trigger; 316 318 for (var ii = 0; ii < targets.length; ii++) { 317 - 318 - // If the drop target indicator is above the target, we need to adjust 319 - // the target's trigger height down accordingly. This makes dragging 320 - // items down the list smoother, because the target doesn't jump to the 321 - // next item while the cursor is over it. 322 - 323 319 trigger = targets[ii].y; 324 - if (adjust_y <= trigger) { 325 - trigger += adjust_h; 326 - } 327 320 328 321 // If the cursor is above this target, we aren't dropping underneath it. 329 - 330 322 if (trigger >= p.y) { 331 323 continue; 332 324 } 333 325 334 326 // Don't choose the dragged row or its predecessor as targets. 335 - 336 327 cur_target = targets[ii].item; 337 328 if (!dragging) { 338 329 // If the item on the cursor isn't from this list, it can't be 339 330 // dropped onto itself or its predecessor in this list. 340 331 } else { 341 - if (cur_target == dragging) { 332 + if (cur_target === dragging) { 342 333 cur_target = false; 343 334 } 344 - if (targets[ii - 1] && targets[ii - 1].item == dragging) { 335 + if (targets[ii - 1] && (targets[ii - 1].item === dragging)) { 345 336 cur_target = false; 346 337 } 347 338 } ··· 480 471 for (var ii = 0; ii < group.length; ii++) { 481 472 JX.DOM.alterClass(group[ii].getRootNode(), 'drag-target-list', false); 482 473 group[ii]._clearTarget(); 483 - group[ii]._dirtyTargetCache(); 484 474 group[ii]._lastAdjust = null; 485 475 } 486 476