]> _ Git - fluidbook-html5.git/commitdiff
fix #2728 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 15 May 2019 14:29:32 +0000 (16:29 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 15 May 2019 14:29:32 +0000 (16:29 +0200)
js/libs/fluidbook/fluidbook.desktop.js
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.touch.js
js/libs/fluidbook/fluidbook.zoom.js
style/fluidbook.less
style/help.less

index 961953ad0954990e1eb0bf130e9a9b967d8bcd1a..d8798bc543490fc8ef6168c102cffa52a636e75f 100644 (file)
@@ -16,7 +16,7 @@ FluidbookDesktop.prototype = {
             }
         });
         $(document).on('click', '#links', function (e) {
-            if ($this.fluidbook.input.isUsingMouse()) {
+            if ($this.fluidbook.zoom.enabled && $this.fluidbook.input.isUsingMouse()) {
                 $this.clickZoom(e);
                 return false;
             }
@@ -25,14 +25,16 @@ FluidbookDesktop.prototype = {
             e.stopPropagation();
         })
 
-        if (!this.fluidbook.mobilefirst.enabled) {
-            $(document).on('mousewheel', function (e) {
-                $this.wheelZoom(e.deltaY);
-            });
-        }
 
+        $(document).on('mousewheel', function (e) {
+            if ($this.fluidbook.zoom.enabled) {
+                $this.wheelZoom(e.deltaY);
+            }
+        });
         $(document).on('mousemove', 'body', function (e) {
-            $this.moveZoom(e);
+            if ($this.fluidbook.zoom.enabled) {
+                $this.moveZoom(e);
+            }
         });
     },
     moveZoom: function (e, force) {
index 1dfc4fb3ff6b04b60f0a87df36270a8d00dd6f52..355e0c24cdbe5f98bd45fa7b04a24bed390a5a02 100644 (file)
@@ -36,6 +36,7 @@ Fluidbook.prototype = {
         this.contentlock = new FluidbookContentLock(this);
         this.menu = new FluidbookMenu(this);
         this.support = new FluidbookSupport(this);
+        this.mobilefirst = new FluidbookMobileFirst(this);
         this.zoom = new FluidbookZoom(this);
         this.zoom.resetZoom();
         this.cache = new FluidbookCache(datas);
@@ -43,7 +44,6 @@ Fluidbook.prototype = {
         this.loader = new FluidbookLoader(this);
         this.search = new FluidbookSearch(this);
         this.pad = new FluidbookPad(this);
-        this.mobilefirst = new FluidbookMobileFirst(this);
         this.scorm = new FluidbookScorm(this);
         this.links = new FluidbookLinks(this);
         this.waiters = [];
index c7b17bff540d508dfbc69d6b46bd1af39df0c1f8..5b633d2a34b645e8a627245d324baac4b94abe4a 100644 (file)
@@ -55,39 +55,46 @@ FluidbookTouch.prototype = {
         // Double tap
         hm.on('doubletap', function (event) {
             console.log('doubletap');
-            if ($this.fluidbook.zoom.zoom > 1) {
-                $this.fluidbook.zoom.setTransition(true);
-                $this.fluidbook.zoom.resetZoom();
-            } else {
-                $this.setZoomOriginFromEvent(event.srcEvent);
-                $this.fluidbook.zoom.setTransition(true);
-                $this.fluidbook.zoom.setZoom($this.fluidbook.datas.zoom / 100, 1)
+            if ($this.fluidbook.zoom.enabled) {
+                if ($this.fluidbook.zoom.zoom > 1) {
+                    $this.fluidbook.zoom.setTransition(true);
+                    $this.fluidbook.zoom.resetZoom();
+                } else {
+                    $this.setZoomOriginFromEvent(event.srcEvent);
+                    $this.fluidbook.zoom.setTransition(true);
+                    $this.fluidbook.zoom.setZoom($this.fluidbook.datas.zoom / 100, 1)
+                }
             }
             event.preventDefault();
         });
-        // Pinch
 
+        // Pinch
         hm.on('pinchstart', function (event) {
-            console.log('pinchstart');
-            if ($this.fluidbook.zoom.zoom === 1) {
-                $this.setZoomOriginFromEvent({'pageX': event.center.x, 'pageY': event.center.y});
+            if ($this.fluidbook.zoom.enabled) {
+                if ($this.fluidbook.zoom.zoom === 1) {
+                    $this.setZoomOriginFromEvent({'pageX': event.center.x, 'pageY': event.center.y});
+                }
+                $this.zoomAtPinchStart = $this.fluidbook.zoom.zoom;
+                $this.pinchZoom(event.scale, false);
             }
-            $this.zoomAtPinchStart = $this.fluidbook.zoom.zoom;
-            $this.pinchZoom(event.scale, false);
             event.preventDefault();
         });
 
         hm.on('pinch', function (event) {
-            console.log('pinch');
-            if ($this.zoomAtPinchStart !== 0) {
-                $this.pinchZoom(event.scale, false);
-                event.preventDefault();
+            if ($this.fluidbook.zoom.enabled) {
+                console.log('pinch');
+                if ($this.zoomAtPinchStart !== 0) {
+                    $this.pinchZoom(event.scale, false);
+                    event.preventDefault();
+                }
             }
         });
         hm.on('pinchend pinchcancel', function (event) {
-            console.log('pinchend');
-            $this.pinchZoom(event.scale, true);
-            $this.zoomAtPinchStart = $this.fluidbook.zoom.zoom;
+            if ($this.fluidbook.zoom.enabled) {
+                console.log('pinchend');
+                $this.pinchZoom(event.scale, true);
+                $this.zoomAtPinchStart = $this.fluidbook.zoom.zoom;
+            }
             event.preventDefault();
         });
 
index 9236d5312c762694ea475762098d3f49cb0f1a87..a3c566a8bb6a1b5a842c1e34b0de098e83f8019c 100644 (file)
@@ -5,6 +5,7 @@ function FluidbookZoom(fluidbook) {
     this.originpx = ['0px', '0px'];
     this.max = this.fluidbook.datas.zoomw / 100;
     this.transition = true;
+    this.enabled = true;
     this.shadowTimeout;
     this.hideInterfaceTimeout;
     this.init();
@@ -12,6 +13,11 @@ function FluidbookZoom(fluidbook) {
 
 FluidbookZoom.prototype = {
     init: function () {
+        if (this.fluidbook.mobilefirst.enabled) {
+            this.disable();
+            return;
+        }
+
         var $this = this;
         this.setTransition(true);
 
@@ -35,6 +41,11 @@ FluidbookZoom.prototype = {
 
     },
 
+    disable: function () {
+        this.enabled = false;
+        $('body').addClass('zoom-disabled');
+    },
+
     triggerEvent: function (event) {
         var e = 'fluidbook.zoom.' + event;
         $(this.fluidbook).trigger(e);
index 625ed13bbdfbf1e0c777d410c70dd30e3e9c098c..c78edca7a10c86ee6a900029353a931e02edec6f 100644 (file)
@@ -191,12 +191,12 @@ body, html {
 
 .msie {
   &.desktop {
-    #links {
+    #links .nonlinkarea {
       cursor: url(./images/cursors/zoom-in.cur), auto;
     }
 
     .zoomed {
-      #links {
+      #links .nonlinkarea {
         cursor: url(./images/cursors/zoom-out.cur), auto;
       }
     }
@@ -205,12 +205,12 @@ body, html {
 
 &.no-msie {
   &.desktop {
-    #links {
+    #links .nonlinkarea {
       cursor: zoom-in;
     }
 
     .zoomed {
-      #links {
+      #links .nonlinkarea {
         cursor: zoom-out;
       }
     }
@@ -1335,6 +1335,11 @@ html.ios body.portrait #interface {
   left: 0px;
   display: block;
   cursor: zoom-in;
+
+  .zoom-disabled & {
+    cursor: auto !important;
+    pointer-events: none;
+  }
 }
 
 /* Bookmarks */
index a8f2abafbe35405261dbc80dbb95cd8f7903ff78..7dbcc3408bafd868e4d1c5ffa8d323be64f750be 100644 (file)
 
   .illustration {
 
-    .no-using-touch &.touch{
+    .zoom-disabled & {
       display: none;
     }
-    .no-using-mouse &.mouse{
+
+    .no-using-touch &.touch {
+      display: none;
+    }
+
+    .no-using-mouse &.mouse {
       display: none;
     }