1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Make waving cover files around on boards more reliable

Summary:
Currently, in Safari, if you drag an image onto a board to make it a cover file and then wave it around wildly a lot over differnent cards, it sometimes glitches out a bit and won't drop on them properly.

This appears to be because sequencing and delivery of dragenter/dragleave events isn't always totally ideal.

Instead, just cancel any existing drag when we get a new drag that targets a new drop target.

Test Plan:
  - Opened a board with a bunch of cards.
  - Dragged a file from my desktop onto the board.
  - Waved it around wildly, hovering over many different cards.
    - Before patch: sometimes cards under the cursor stopped highlighting properly.
    - After patch: behavior seems correct and consistent.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D15208
This commit is contained in:
epriestley 2016-02-07 15:02:00 -08:00
parent b5518d4bfb
commit 4dd6a1224d
2 changed files with 22 additions and 13 deletions

View file

@ -11,7 +11,7 @@ return array(
'core.pkg.js' => '808ae845',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '2de124c9',
'differential.pkg.js' => '6b42b4bc',
'differential.pkg.js' => 'd0cd0df6',
'diffusion.pkg.css' => 'f45955ed',
'diffusion.pkg.js' => '3a9a8bfa',
'maniphest.pkg.css' => '4845691a',
@ -446,7 +446,7 @@ return array(
'rsrc/js/application/uiexample/gesture-example.js' => '558829c2',
'rsrc/js/application/uiexample/notification-example.js' => '8ce821c5',
'rsrc/js/core/Busy.js' => '59a7976a',
'rsrc/js/core/DragAndDropFileUpload.js' => 'da044194',
'rsrc/js/core/DragAndDropFileUpload.js' => '81f182b5',
'rsrc/js/core/DraggableList.js' => '8905523d',
'rsrc/js/core/FileUpload.js' => '680ea2c8',
'rsrc/js/core/Hovercard.js' => '1bd28176',
@ -741,7 +741,7 @@ return array(
'phabricator-core-css' => '5b3563c8',
'phabricator-countdown-css' => 'e7544472',
'phabricator-dashboard-css' => 'eb458607',
'phabricator-drag-and-drop-file-upload' => 'da044194',
'phabricator-drag-and-drop-file-upload' => '81f182b5',
'phabricator-draggable-list' => '8905523d',
'phabricator-fatal-config-template-css' => '8e6c6fcd',
'phabricator-feed-css' => 'ecd4ec57',
@ -1451,6 +1451,14 @@ return array(
'javelin-vector',
'javelin-stratcom',
),
'81f182b5' => array(
'javelin-install',
'javelin-util',
'javelin-request',
'javelin-dom',
'javelin-uri',
'phabricator-file-upload',
),
'834a1173' => array(
'javelin-behavior',
'javelin-scrollbar',
@ -1890,14 +1898,6 @@ return array(
'javelin-util',
'phabricator-shaped-request',
),
'da044194' => array(
'javelin-install',
'javelin-util',
'javelin-request',
'javelin-dom',
'javelin-uri',
'phabricator-file-upload',
),
'dbbf48b6' => array(
'javelin-behavior',
'javelin-stratcom',

View file

@ -107,13 +107,18 @@ JX.install('PhabricatorDragAndDropFileUpload', {
return;
}
if (!this._node && !this._depth) {
this._target = e.getNode(this._sigil);
if (!this._node) {
var target = e.getNode(this._sigil);
if (target !== this._target) {
this._updateDepth(-this._depth);
this._target = target;
}
}
if (contains(this._getTarget(), e.getTarget())) {
this._updateDepth(1);
}
});
var on_dragleave = JX.bind(this, function(e) {
@ -121,6 +126,10 @@ JX.install('PhabricatorDragAndDropFileUpload', {
return;
}
if (!this._getTarget()) {
return;
}
if (contains(this._getTarget(), e.getTarget())) {
this._updateDepth(-1);
}