From b417cfdf9abd6a8fc0f15f64853359097d8c2a41 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 9 May 2019 19:47:18 +0200 Subject: [PATCH] wip #2707 @2.5 --- js/libs/fluidbook/fluidbook.menu.js | 8 ++++++-- js/libs/fluidbook/fluidbook.mobilefirst.js | 8 ++++++++ js/libs/fluidbook/fluidbook.touch.js | 15 ++++++++------- style/mobilefirst.less | 11 +++++++++++ 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.menu.js b/js/libs/fluidbook/fluidbook.menu.js index 276afd90..c5392671 100644 --- a/js/libs/fluidbook/fluidbook.menu.js +++ b/js/libs/fluidbook/fluidbook.menu.js @@ -452,7 +452,7 @@ FluidbookMenu.prototype = { this.fluidbook.stats.track(14); }, openIndex: function (title, group, closeAll, callback) { - this.index.openIndex(title,group,closeAll,callback); + this.index.openIndex(title, group, closeAll, callback); }, openArchives: function (title, callback) { var archives = '
' + this.closeButton() + '

' + title + '

'; @@ -596,7 +596,11 @@ FluidbookMenu.prototype = { break; case 'index': fullscreen = true; - $("#indexViewHolder").css('width', Math.floor(ww / 230) * 230); + if (this.fluidbook.mobilefirst.enabled) { + this.fluidbook.mobilefirst.resizeIndex(); + } else { + $("#indexViewHolder").css('width', Math.floor(ww / 230) * 230); + } break; case 'share': w = 200; diff --git a/js/libs/fluidbook/fluidbook.mobilefirst.js b/js/libs/fluidbook/fluidbook.mobilefirst.js index c03ff143..838b85e0 100644 --- a/js/libs/fluidbook/fluidbook.mobilefirst.js +++ b/js/libs/fluidbook/fluidbook.mobilefirst.js @@ -107,4 +107,12 @@ FluidbookMobileFirst.prototype = { return footer; }, + + resizeIndex: function () { + $("#indexViewHolder").css('width', this.fluidbook.datas.pages * 130); + setTimeout(function () { + $("#indexView").perfectScrollbar('update'); + }, 500) + $("#indexView").perfectScrollbar(); + }, } \ No newline at end of file diff --git a/js/libs/fluidbook/fluidbook.touch.js b/js/libs/fluidbook/fluidbook.touch.js index b5c993f0..c7b17bff 100644 --- a/js/libs/fluidbook/fluidbook.touch.js +++ b/js/libs/fluidbook/fluidbook.touch.js @@ -69,7 +69,7 @@ FluidbookTouch.prototype = { hm.on('pinchstart', function (event) { console.log('pinchstart'); - if ($this.fluidbook.zoom.zoom == 1) { + if ($this.fluidbook.zoom.zoom === 1) { $this.setZoomOriginFromEvent({'pageX': event.center.x, 'pageY': event.center.y}); } $this.zoomAtPinchStart = $this.fluidbook.zoom.zoom; @@ -79,7 +79,7 @@ FluidbookTouch.prototype = { hm.on('pinch', function (event) { console.log('pinch'); - if ($this.zoomAtPinchStart != 0) { + if ($this.zoomAtPinchStart !== 0) { $this.pinchZoom(event.scale, false); event.preventDefault(); } @@ -94,14 +94,12 @@ FluidbookTouch.prototype = { var hmf = new Hammer.Manager(document.getElementById('fluidbook'), options); hmf.add(new Hammer.Pan({threshold: 0})); hmf.on('panmove', function (event) { - console.log('panmove'); if ($this.drag(event)) { console.log('prevent scroll') event.preventDefault(); } }); hmf.on('panend', function (event) { - console.log('panend'); var prevent = $this.drag(event, true); $this.startX = $this.startY = -1; $this.panX = $this.panY = 0; @@ -112,7 +110,7 @@ FluidbookTouch.prototype = { }, pinchZoom: function (s, end) { - if (s == 1) { + if (s === 1) { return; } @@ -133,10 +131,13 @@ FluidbookTouch.prototype = { drag: function (e, end) { - if (end == undefined) { + if (end === undefined) { end = false; } if (this.fluidbook.zoom.zoom === 1) { + if (this.fluidbook.mobilefirst.enabled) { + return false; + } if (this.startX === -1) { this.startX = e.center.x; } @@ -167,7 +168,7 @@ FluidbookTouch.prototype = { this.panX = e.deltaX; this.panY = e.deltaY; - if (e.dx == 0 && e.dy == 0) { + if (e.dx === 0 && e.dy === 0) { return; } diff --git a/style/mobilefirst.less b/style/mobilefirst.less index e2bdfdf6..b7bb511f 100644 --- a/style/mobilefirst.less +++ b/style/mobilefirst.less @@ -57,6 +57,17 @@ } } } + + #indexView { + min-width: 100%; + height: 100%; + overflow-x: auto; + padding: 25px; + + #indexViewHolder { + margin-top: 5px; + } + } } -- 2.39.5