]> _ Git - fluidbook-html5.git/commitdiff
wip #2502 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 10 Jan 2019 16:02:53 +0000 (17:02 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 10 Jan 2019 16:02:53 +0000 (17:02 +0100)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.pagetransitions.js
js/libs/fluidbook/fluidbook.slider.js

index 24e999224f0ee3e5b149b1db90e5aa62f1136336..33a10867fbea0822afd5b1e045ffcf18df29ba83 100644 (file)
@@ -24,6 +24,7 @@ Fluidbook.prototype = {
         this.networkPause = false;
         this.networkPauseTimeout = null;
         this.networkPauseQueue = [];
+        this.canNavigate = false;
 
         this.datas = datas;
         this.singleMode = (this.datas.mobileNavigationType === 'portrait');
@@ -187,6 +188,7 @@ Fluidbook.prototype = {
     },
 
     __hideSplash: function () {
+
         $("#main,#viewOverlay,#view").css('visibility', 'visible');
         this.resize.resize(false, true);
         this.hideLoader(0, true);
@@ -201,9 +203,19 @@ Fluidbook.prototype = {
             })
         }
 
+        this.allowChangePage(1.5);
         $(this).trigger('fluidbook.splash.hide');
     },
 
+    allowChangePage: function (timeout) {
+        var $this = this;
+        setTimeout(function () {
+            console.log('can change page');
+            $this.canNavigate = true;
+            $($this).trigger('fluidbook.navigation.cannavigate');
+        }, timeout * 1000);
+    },
+
     ready: function () {
         if (this.isReady) {
             return;
@@ -257,6 +269,14 @@ Fluidbook.prototype = {
     hidePage: function (position) {
         $("#pages ." + position).hide();
     },
+    canChangePage: function () {
+        try {
+            return this.pagetransitions.canChangePage();
+        } catch (e) {
+
+        }
+        return false;
+    },
     initVideos: function () {
         var $this = this;
         $(".videoContainer").each(function () {
@@ -272,28 +292,28 @@ Fluidbook.prototype = {
         return offset;
     },
     goNextPage: function () {
-        if (this.pagetransitions.transitionning) {
+        if (!this.pagetransitions.canChangePage()) {
             return;
         }
         this.transitionAxis = 'x';
         this.setCurrentPage(this.normalizePage(this.currentPage) + this.getNextOffset());
     },
     goFirstPage: function () {
-        if (this.pagetransitions.transitionning) {
+        if (!this.pagetransitions.canChangePage()) {
             return;
         }
         this.transitionAxis = 'x';
         this.setCurrentPage(1);
     },
     goPreviousPage: function () {
-        if (this.pagetransitions.transitionning) {
+        if (!this.pagetransitions.canChangePage()) {
             return;
         }
         this.transitionAxis = 'x';
         this.setCurrentPage(this.normalizePage(this.currentPage) - this.getNextOffset());
     },
     goLastPage: function () {
-        if (this.pagetransitions.transitionning) {
+        if (!this.pagetransitions.canChangePage()) {
             console.log('golastpage skip');
             return;
         }
@@ -301,7 +321,7 @@ Fluidbook.prototype = {
         this.setCurrentPage(this.contentlock.getMaxPage());
     },
     goNextChapter: function () {
-        if (this.pagetransitions.transitionning) {
+        if (!this.pagetransitions.canChangePage()) {
             return;
         }
         var next = this.bookmarks.getNextGroupCover(this.currentPage);
@@ -312,7 +332,7 @@ Fluidbook.prototype = {
         this.setCurrentPage(this.normalizePage(next));
     },
     goPreviousChapter: function () {
-        if (this.pagetransitions.transitionning) {
+        if (!this.pagetransitions.canChangePage()) {
             return;
         }
         var prev = this.bookmarks.getPreviousGroupCover(this.currentPage);
@@ -323,7 +343,7 @@ Fluidbook.prototype = {
         this.setCurrentPage(this.normalizePage(prev));
     },
     goNextChapterPage: function () {
-        if (this.pagetransitions.transitionning) {
+        if (!this.pagetransitions.canChangePage()) {
             return;
         }
 
@@ -335,7 +355,7 @@ Fluidbook.prototype = {
         this.setCurrentPage(this.normalizePage(next));
     },
     goPreviousChapterPage: function () {
-        if (this.pagetransitions.transitionning) {
+        if (!this.pagetransitions.canChangePage()) {
             return;
         }
 
index 0119a51e8cab33cd6cacf4588cc84a82196af1a7..1064cccbcfbd3fa7998f89cc9dbbafb58142fb40 100644 (file)
@@ -381,4 +381,8 @@ FluidbookPageTransition.prototype = {
         $(this.fluidbook).trigger('fluidbook.page.change.end', [this.fluidbook.currentPage]);
     },
 
+
+    canChangePage: function () {
+        return this.fluidbook.canNavigate && !this.transitionning;
+    },
 }
\ No newline at end of file
index df5c4e913c2ad662c9e6347ea29fa66e1280f685..a8de41b7d1682e40ad978bd8c059e413d0036ea1 100644 (file)
@@ -84,7 +84,7 @@ FluidbookSlider.prototype = {
         }
         var page = this.getPageByX(pos)
 
-        if (gotoPage) {
+        if (gotoPage && this.fluidbook.canChangePage()) {
             this.fluidbook.setCurrentPage(page);
         }
         if (updateCursor) {