From 6529b474de43940e72541b2530e9fef9e75efee5 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 15 May 2019 16:29:32 +0200 Subject: [PATCH] fix #2728 @1 --- js/libs/fluidbook/fluidbook.desktop.js | 16 +++++---- js/libs/fluidbook/fluidbook.js | 2 +- js/libs/fluidbook/fluidbook.touch.js | 47 +++++++++++++++----------- js/libs/fluidbook/fluidbook.zoom.js | 11 ++++++ style/fluidbook.less | 13 ++++--- style/help.less | 9 +++-- 6 files changed, 64 insertions(+), 34 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.desktop.js b/js/libs/fluidbook/fluidbook.desktop.js index 961953ad..d8798bc5 100644 --- a/js/libs/fluidbook/fluidbook.desktop.js +++ b/js/libs/fluidbook/fluidbook.desktop.js @@ -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) { diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index 1dfc4fb3..355e0c24 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -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 = []; diff --git a/js/libs/fluidbook/fluidbook.touch.js b/js/libs/fluidbook/fluidbook.touch.js index c7b17bff..5b633d2a 100644 --- a/js/libs/fluidbook/fluidbook.touch.js +++ b/js/libs/fluidbook/fluidbook.touch.js @@ -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(); }); diff --git a/js/libs/fluidbook/fluidbook.zoom.js b/js/libs/fluidbook/fluidbook.zoom.js index 9236d531..a3c566a8 100644 --- a/js/libs/fluidbook/fluidbook.zoom.js +++ b/js/libs/fluidbook/fluidbook.zoom.js @@ -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); diff --git a/style/fluidbook.less b/style/fluidbook.less index 625ed13b..c78edca7 100644 --- a/style/fluidbook.less +++ b/style/fluidbook.less @@ -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 */ diff --git a/style/help.less b/style/help.less index a8f2abaf..7dbcc340 100644 --- a/style/help.less +++ b/style/help.less @@ -23,10 +23,15 @@ .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; } -- 2.39.5