From 41af352b29e84d5127dc8ba1fa66aca57596bd1d Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 2 May 2017 14:05:11 +0200 Subject: [PATCH] fix #1374 @1.5 --- js/libs/fluidbook/fluidbook.nav.js | 4 ++-- js/libs/fluidbook/fluidbook.resize.js | 17 +---------------- js/libs/fluidbook/fluidbook.touch.js | 1 - js/main.js | 13 +++++++++---- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.nav.js b/js/libs/fluidbook/fluidbook.nav.js index 673c3707..69e0972b 100644 --- a/js/libs/fluidbook/fluidbook.nav.js +++ b/js/libs/fluidbook/fluidbook.nav.js @@ -251,7 +251,7 @@ FluidbookNav.prototype = { var res = this.getLink('interface-previous', '#', 'previous', '', '', false); res += this.getLink('interface-next', '#', 'next', '', '', false); $('#interface').append(res); - $(document).on('click touchend', '#next', goNextPage); - $(document).on('click touchend', '#previous', goPreviousPage); + $(document).on('touchstart click', '#next', goNextPage); + $(document).on('touchstart click', '#previous', goPreviousPage); } }; \ No newline at end of file diff --git a/js/libs/fluidbook/fluidbook.resize.js b/js/libs/fluidbook/fluidbook.resize.js index f7b1ee97..b77de0b5 100644 --- a/js/libs/fluidbook/fluidbook.resize.js +++ b/js/libs/fluidbook/fluidbook.resize.js @@ -118,24 +118,9 @@ FluidbookResize.prototype = { if (this.orientation == 'landscape') { fww *= 2; } - // console.log('aw : ' + aw); - // console.log('fww : ' + fww); - // console.log('ah : ' + ah); - // console.log('fhh : ' + fhh); - // console.log('interfaceScale : ' + interfaceScale); - // console.log('extraX : ' + extraX); - // console.log('margintop : ' + this.margintop); - // console.log('marginbottom : ' + this.marginbottom); - // console.log('marginleft : ' + this.marginleft); - // console.log('marginright : ' + this.marginright); - console.log('marginLeft : ' + marginLeft); - console.log('marginTop : ' + marginTop); - console.log('marginBottom : ' + marginBottom); - console.log('marginRight : ' + marginRight); - this.bookScale = Math.min(aw / fww, ah / fhh); - console.log('bookScale : ' + this.bookScale); + var fw = this.bookScale * fww; var fh = this.bookScale * fhh; $("#fluidbook").transform({ diff --git a/js/libs/fluidbook/fluidbook.touch.js b/js/libs/fluidbook/fluidbook.touch.js index a18959b1..b54d1f91 100644 --- a/js/libs/fluidbook/fluidbook.touch.js +++ b/js/libs/fluidbook/fluidbook.touch.js @@ -71,7 +71,6 @@ FluidbookTouch.prototype = { }, dragzoom: function (e) { - console.log(e.dx + ' :: ' + e.dy); if (e.dx == 0 && e.dy == 0) { return; } diff --git a/js/main.js b/js/main.js index a8beb3cb..0f3f250d 100644 --- a/js/main.js +++ b/js/main.js @@ -491,12 +491,15 @@ function goNextPage(e) { if (fluidbook.help.isVisible()) { return; } - try { + + if (e.originalEvent.touches != undefined && e.originalEvent.touches.length > 0) { + var o = $("#next").offset(); y = e.originalEvent.touches[0].pageY - o.top; - } catch (err) { + } else { y = e.offsetY == undefined ? e.originalEvent.layerY : e.offsetY; } + if (y < 65) { if (fluidbook.pad.enabled) { fluidbook.goNextChapter(); @@ -514,9 +517,11 @@ function goPreviousPage(e) { return; } var y; - try { + + if (e.originalEvent.touches != undefined && e.originalEvent.touches.length > 0) { + var o = $("#previous").offset(); y = e.originalEvent.touches[0].pageY - o.top; - } catch (err) { + } else { y = e.offsetY == undefined ? e.originalEvent.layerY : e.offsetY; } if (y < 65) { -- 2.39.5