diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-12-14 18:12:12 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-12-14 21:42:39 +0100 |
commit | de4028336aca79ab243fc0d1ad3a904d4cc72299 (patch) | |
tree | 7e02339ad33929ddeba957c5499a9b934f285441 /core/vendor | |
parent | a5db0d2825424f505f9139af6d439108b9e07782 (diff) | |
download | nextcloud-server-de4028336aca79ab243fc0d1ad3a904d4cc72299.tar.gz nextcloud-server-de4028336aca79ab243fc0d1ad3a904d4cc72299.zip |
Force the drag to end when the navigation bar Snap is disabled by an app
When a Snap was disabled it stopped listening to the events, but if a
drag gesture was being performed it was kept as active. Thus, when the
Snap was enabled again move events were handled as if the Snap had never
been disabled, causing the gesture handling to continue where it was
left.
When the Snap for the navigation bar is disabled by an app it could be
as a result of a different gesture being recognized by the app (for
example, a vertical swipe) once both gestures have started. In that case
when the other gesture ends and the Snap is enabled again any pointer
movement will cause the navigation bar to slide until an "up" event is
triggered again (obviously not the desired behaviour).
Due to all this now when the Snap for the navigation bar is disabled by
an app the current drag gesture for the navigation bar is ended.
Note that this was added as a parameter to "Snap.disable()" instead of
done unconditionally to keep back-compatibility with the previous
behaviour (probably not really needed as it is unlikely that any app is
using the Snap library relying on that behaviour... but just in case).
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'core/vendor')
-rw-r--r-- | core/vendor/core.js | 6 | ||||
-rw-r--r-- | core/vendor/snapjs/dist/latest/snap.js | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/core/vendor/core.js b/core/vendor/core.js index bda270892ad..e573ef10642 100644 --- a/core/vendor/core.js +++ b/core/vendor/core.js @@ -6704,9 +6704,13 @@ dav.Client.prototype = { /** * Disables Snap.js events + * @param {Boolean} endCurrentDrag Whether to end the current drag (if any) or not. */ - disable: function() { + disable: function(endCurrentDrag) { utils.dispatchEvent('disable'); + if (endCurrentDrag) { + this.action.drag.endDrag(); + } this.action.drag.stopListening(); }, diff --git a/core/vendor/snapjs/dist/latest/snap.js b/core/vendor/snapjs/dist/latest/snap.js index a0274138de0..7ae088d0aea 100644 --- a/core/vendor/snapjs/dist/latest/snap.js +++ b/core/vendor/snapjs/dist/latest/snap.js @@ -744,9 +744,13 @@ /** * Disables Snap.js events + * @param {Boolean} endCurrentDrag Whether to end the current drag (if any) or not. */ - disable: function() { + disable: function(endCurrentDrag) { utils.dispatchEvent('disable'); + if (endCurrentDrag) { + this.action.drag.endDrag(); + } this.action.drag.stopListening(); }, |