1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

When users scroll while dragging items, update item positions immediately

Summary:
Fixes T5979. When you drag a task and scroll using the mouse wheel, we don't move the task under your cursor until you move the mouse.

Instead, listen for `scroll` and move the task.

Test Plan:
  - Clicked and dragged a task.
  - While holding the task and not moving the cursor, used the mouse wheel to scroll.
  - The task followed the cursor (previously, it stayed in position until the mouse was moved again).

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5979

Differential Revision: https://secure.phabricator.com/D10416
This commit is contained in:
epriestley 2014-09-04 12:47:43 -07:00
parent d8e3f2edf2
commit aaa08edb12
2 changed files with 27 additions and 12 deletions

View file

@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => '974635bb',
'core.pkg.js' => 'f67c8265',
'core.pkg.js' => '4e529147',
'darkconsole.pkg.js' => 'df001cab',
'differential.pkg.css' => '36884139',
'differential.pkg.js' => '73337d1d',
@ -438,7 +438,7 @@ return array(
'rsrc/js/application/uiexample/notification-example.js' => '7a9677fc',
'rsrc/js/core/Busy.js' => '6453c869',
'rsrc/js/core/DragAndDropFileUpload.js' => '8c49f386',
'rsrc/js/core/DraggableList.js' => 'bfccc644',
'rsrc/js/core/DraggableList.js' => '98d13594',
'rsrc/js/core/FileUpload.js' => 'a4ae61bf',
'rsrc/js/core/Hovercard.js' => '7e8468ae',
'rsrc/js/core/KeyboardShortcut.js' => '1ae869f2',
@ -713,7 +713,7 @@ return array(
'phabricator-crumbs-view-css' => 'a49339de',
'phabricator-dashboard-css' => 'a2bfdcbf',
'phabricator-drag-and-drop-file-upload' => '8c49f386',
'phabricator-draggable-list' => 'bfccc644',
'phabricator-draggable-list' => '98d13594',
'phabricator-fatal-config-template-css' => '25d446d6',
'phabricator-feed-css' => '7bfc6f12',
'phabricator-file-upload' => 'a4ae61bf',
@ -1437,6 +1437,14 @@ return array(
'javelin-dom',
'javelin-reactor-dom',
),
'98d13594' => array(
'javelin-install',
'javelin-dom',
'javelin-stratcom',
'javelin-util',
'javelin-vector',
'javelin-magical-init',
),
'9c2623f4' => array(
'javelin-behavior',
'javelin-stratcom',
@ -1633,14 +1641,6 @@ return array(
'javelin-util',
'phabricator-shaped-request',
),
'bfccc644' => array(
'javelin-install',
'javelin-dom',
'javelin-stratcom',
'javelin-util',
'javelin-vector',
'javelin-magical-init',
),
'c4569c05' => array(
'javelin-magical-init',
'javelin-install',

View file

@ -21,6 +21,7 @@ JX.install('DraggableList', {
JX.DOM.listen(this._root, 'mousedown', sigil, JX.bind(this, this._ondrag));
JX.Stratcom.listen('mousemove', null, JX.bind(this, this._onmove));
JX.Stratcom.listen('scroll', null, JX.bind(this, this._onmove));
JX.Stratcom.listen('mouseup', null, JX.bind(this, this._ondrop));
},
@ -51,6 +52,7 @@ JX.install('DraggableList', {
_ghostHandler : null,
_ghostNode : null,
_group : null,
_lastMousePosition: null,
getRootNode : function() {
return this._root;
@ -329,11 +331,24 @@ JX.install('DraggableList', {
},
_onmove : function(e) {
// We'll get a callback here for "mousemove" (and can determine the
// location of the cursor) and also for "scroll" (and can not). If this
// is a move, save the mouse position, so if we get a scroll next we can
// reuse the known position.
if (e.getType() == 'mousemove') {
this._lastMousePosition = JX.$V(e);
}
if (!this._dragging) {
return;
}
var p = JX.$V(e);
if (!this._lastMousePosition) {
return;
}
var p = JX.$V(this._lastMousePosition.x, this._lastMousePosition.y);
var group = this._group;
var target_list = this._getTargetList(p);