[Libreoffice-commits] online.git: loleaflet/src

Mihai Varga mihai.varga at collabora.com
Fri Aug 14 05:32:48 PDT 2015


 loleaflet/src/control/Parts.js |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 326b7c54947832c6634e409247cdb1cf85c404db
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Fri Aug 14 15:32:25 2015 +0300

    loleaflet: goToPage accepts 'next' and 'prev'

diff --git a/loleaflet/src/control/Parts.js b/loleaflet/src/control/Parts.js
index e7ee57a..1387663 100644
--- a/loleaflet/src/control/Parts.js
+++ b/loleaflet/src/control/Parts.js
@@ -85,11 +85,20 @@ L.Map.include({
 
 	goToPage: function (page) {
 		var docLayer = this._docLayer;
-		if (page < 0 || page >= docLayer._pages) {
-			return;
+		if (page === 'prev') {
+			if (docLayer._currentPage > 0) {
+				docLayer._currentPage -= 1;
+			}
+		}
+		else if (page === 'next') {
+			if (docLayer._currentPage < docLayer._pages - 1) {
+				docLayer._currentPage += 1;
+			}
+		}
+		else if (typeof (page) === 'number' && page >= 0 && page < docLayer._pages) {
+			docLayer._currentPage = page;
 		}
-		docLayer._currentPage = page;
-		docLayer.sendMessage('setpage page=' + page);
+		docLayer.sendMessage('setpage page=' + docLayer._currentPage);
 	},
 
 	getNumberOfPages: function () {


More information about the Libreoffice-commits mailing list