]> _ Git - fluidbook-html5.git/commitdiff
#2277 @0:20
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 6 Feb 2019 16:29:07 +0000 (17:29 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 6 Feb 2019 16:29:07 +0000 (17:29 +0100)
js/libs/fluidbook/fluidbook.contentlock.js
js/libs/fluidbook/fluidbook.js

index 3f9b8ae07e9a902e7629674451e43acd20ae5029..a11d2cf4e4bbfa977ef5b1144d7cb1d71cf87645 100644 (file)
@@ -126,20 +126,33 @@ FluidbookContentLock.prototype = {
         return this.linksActions[linkId].indexOf(action) >= 0;
     },
 
-    unlockNextPage: function () {
+    unlockCurrentPage: function () {
+        var $this = this;
+        var change = false;
         $.each(this.locks, function (k, v) {
             if (v.unlocked === 1) {
                 return;
             }
-            if (v.conditions.length === 0) {
+            var currentPage = $this.fluidbook.currentPage;
+            if (currentPage % 2 === 1) {
+                currentPage--;
+            }
+            var lockPage = k;
+            if (lockPage % 2 === 1) {
+                lockPage--;
+            }
+            if (currentPage !== lockPage) {
                 return;
             }
 
             $this.locks[k].unlocked = 1;
+            change = true;
             return true;
         });
-        if (this.getNextLockPage() !== this.getMaxPage()) {
+
+        if (change) {
             this.setMaxPage(this.getNextLockPage(), false);
         }
+
     }
 }
\ No newline at end of file
index 0edb7d7e8beee1c1053302c1ef1e3e3b5c267031..e05911788cdea826d25abc5d22c787d3ea452203 100644 (file)
@@ -1036,8 +1036,8 @@ Fluidbook.prototype = {
         f();
     },
 
-    unlockNextPage: function () {
-        this.contentlock.unlockNextPage();
+    unlockCurrentPage: function () {
+        this.contentlock.unlockCurrentPage();
     },
 
     flushNetworkQueue: function () {