]> _ Git - fluidbook-html5.git/commitdiff
wip #1445 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 9 Jun 2017 09:41:51 +0000 (11:41 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 9 Jun 2017 09:41:51 +0000 (11:41 +0200)
js/libs/fluidbook/fluidbook.resize.js
js/libs/fluidbook/fluidbook.slider.js
style/fluidbook.less

index ea21e1e2bf1964a48a12765a63f97b1e3359fb00..c97847d74962b3a067a404d74d8c4c8ccf6f0987 100644 (file)
@@ -274,5 +274,8 @@ FluidbookResize.prototype = {
             this.fluidbook.zoom.resetZoom();
             this.fluidbook.pageTransition();
         }
+    },
+    getScreenFluidbookWidth:function(){
+        return $("#fluidbook").outerWidth()*fluidbook.resize.bookScale;
     }
 };
\ No newline at end of file
index 458c99b4c8dd1331f8f1c12582fa1dc1bdb470cd..67e61ff0db7d539090a6c8a3b9eee090a1a5537f 100644 (file)
@@ -16,17 +16,26 @@ FluidbookSlider.prototype = {
         });
 
         $("#sliderback").on('click', function (e) {
+            if ($this.fluidbook.transitionning) {
+                return;
+            }
             var left = e.pageX - $(this).offset().left;
-            $this.updatePageByCursorPosition(left);
+            $this.updatePageByCursorPosition(left, true);
         });
     },
 
-    updatePageByCursorPosition: function (pos) {
-        var snap = Math.floor(pos / this.snapsWidth);
-        if (this.fluidbook.orientation == 'portrait') {
-            this.fluidbook.setCurrentPage(snap);
-        } else {
-            this.fluidbook.setCurrentPage(snap * 2);
+    updatePageByCursorPosition: function (pos, updateCursor) {
+        if (updateCursor == undefined) {
+            updateCursor = false;
+        }
+
+        var page = Math.floor(pos / this.snapsWidth);
+        if (this.fluidbook.orientation != 'portrait') {
+            page *= 2;
+        }
+        this.fluidbook.setCurrentPage(page);
+        if (updateCursor) {
+            this.updateCursorPosition(page);
         }
         return false;
     },
@@ -36,10 +45,15 @@ FluidbookSlider.prototype = {
         if (single) {
             this.sliderWidth = ww / 2;
         } else {
-            this.sliderWidth = ww / 3;
+            this.sliderWidth = this.fluidbook.resize.getScreenFluidbookWidth() * 0.4;
         }
         this.sliderWidth = Math.round(this.sliderWidth);
-        $("#slider").css({width: this.sliderWidth, left: (ww - this.sliderWidth) / 2, top: hh - 32});
+        var bottom = 26;
+        if (single) {
+            bottom = 18;
+        }
+
+        $("#slider").css({width: this.sliderWidth, left: (ww - this.sliderWidth) / 2, top: hh - bottom});
         this.updateSnaps(single);
         this.cursorWidth = Math.max(30, this.snapsWidth);
         $("#slidercursor").css('width', this.cursorWidth);
@@ -61,19 +75,20 @@ FluidbookSlider.prototype = {
         this.snapsWidth = this.sliderWidth / this.snapsCount;
     },
 
-    updateCursorPosition: function () {
-
+    updateCursorPosition: function (page) {
+        if (page == undefined) {
+            page = this.fluidbook.currentPage;
+        }
         var left;
         if (this.fluidbook.resize.orientation == 'portrait') {
-            left = this.snapsWidth * (Math.max(1, this.fluidbook.currentPage) - 1);
+            left = this.snapsWidth * (Math.max(1, page) - 1);
         } else {
-            var current = this.fluidbook.currentPage;
-            if (current % 2 == 1 && this.fluidbook.currentPage != this.fluidbook.datas.pages) {
+            var current = page;
+            if (current % 2 == 1 && page != this.fluidbook.datas.pages) {
                 current--;
             }
             left = this.snapsWidth * (current / 2);
         }
-
         $("#slidercursor").css('left', left);
     }
 };
\ No newline at end of file
index d24f1505fba6a6f99398bc5910607fd617a612cf..05fadc1cfaab600cafec00e4cbfb8716f729d55a 100644 (file)
@@ -392,6 +392,7 @@ body, html {
        padding: 0;
        position: absolute;
        white-space: nowrap;
+       pointer-events: none;
 }
 
 #pagesnumbers div {