From: Vincent Vanwaelscappel Date: Wed, 6 Feb 2019 16:29:07 +0000 (+0100) Subject: #2277 @0:20 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=385b7cfbcd853969a2054bf8d6ae249ca696292a;p=fluidbook-html5.git #2277 @0:20 --- diff --git a/js/libs/fluidbook/fluidbook.contentlock.js b/js/libs/fluidbook/fluidbook.contentlock.js index 3f9b8ae0..a11d2cf4 100644 --- a/js/libs/fluidbook/fluidbook.contentlock.js +++ b/js/libs/fluidbook/fluidbook.contentlock.js @@ -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 diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index 0edb7d7e..e0591178 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -1036,8 +1036,8 @@ Fluidbook.prototype = { f(); }, - unlockNextPage: function () { - this.contentlock.unlockNextPage(); + unlockCurrentPage: function () { + this.contentlock.unlockCurrentPage(); }, flushNetworkQueue: function () {