summaryrefslogtreecommitdiffstats
path: root/core/js/js.js
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2017-10-23 01:01:01 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2017-12-14 21:41:22 +0100
commita5db0d2825424f505f9139af6d439108b9e07782 (patch)
tree4bc87315014b0e80f5c3c88a779d6e81f1fec5dc /core/js/js.js
parent173f28a09d4b88e91fe1c2db16f2aab9f171a627 (diff)
downloadnextcloud-server-a5db0d2825424f505f9139af6d439108b9e07782.tar.gz
nextcloud-server-a5db0d2825424f505f9139af6d439108b9e07782.zip
Make possible for apps to disallow the navigation bar slide gesture
On narrow screens a slide gesture can be used to open or close the navigation bar. However that gesture could conflict at times with the gestures used by certain apps (for example, if the right sidebar is open the user may expect to close it by dragging it to the right, but that could open the navigation bar instead depending on how the events are handled). This commit makes possible for apps to disallow and allow again that slide gesture. In any case, note that applications can only disallow the gesture, but they can not enable it. That is, they can prevent the gesture from being used on narrow screens, but they can not make the gesture work on wide screens; they are always limited by the base rules set by the core. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'core/js/js.js')
-rw-r--r--core/js/js.js36
1 files changed, 35 insertions, 1 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 9af80676d5e..c9427bf533d 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1612,12 +1612,46 @@ function initCore() {
snapper.close();
});
+ var navigationBarSlideGestureEnabled = false;
+ var navigationBarSlideGestureAllowed = true;
+ var navigationBarSlideGestureEnablePending = false;
+
+ OC.allowNavigationBarSlideGesture = function() {
+ navigationBarSlideGestureAllowed = true;
+
+ if (navigationBarSlideGestureEnablePending) {
+ snapper.enable();
+
+ navigationBarSlideGestureEnabled = true;
+ navigationBarSlideGestureEnablePending = false;
+ }
+ };
+
+ OC.disallowNavigationBarSlideGesture = function() {
+ navigationBarSlideGestureAllowed = false;
+
+ if (navigationBarSlideGestureEnabled) {
+ snapper.disable();
+
+ navigationBarSlideGestureEnabled = false;
+ navigationBarSlideGestureEnablePending = true;
+ }
+ };
+
var toggleSnapperOnSize = function() {
if($(window).width() > 768) {
snapper.close();
snapper.disable();
- } else {
+
+ navigationBarSlideGestureEnabled = false;
+ navigationBarSlideGestureEnablePending = false;
+ } else if (navigationBarSlideGestureAllowed) {
snapper.enable();
+
+ navigationBarSlideGestureEnabled = true;
+ navigationBarSlideGestureEnablePending = false;
+ } else {
+ navigationBarSlideGestureEnablePending = true;
}
};