[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-7' - loleaflet/src

Jan Holesovsky kendy at collabora.com
Sat Jan 9 14:55:26 PST 2016


 loleaflet/src/map/handler/Map.Keyboard.js |   20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

New commits:
commit 6b9e0368ae084bd15d231f55eae88abb0f4e9d2c
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Sat Jan 9 23:45:09 2016 +0100

    loleaflet: Improve page up / page down handling when viewing only.
    
    Without this, the first PgDown is ignored.
    
    Not sure what the previous code was supposed to handle, but dealing with that
    in the LO core seems to me as a better plan, so let's fix it there if
    something special is still needed for the use case introduced in
    97ac6736f80da773f5e23a6688acc0dc47535d01.

diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js
index 2ce5bf9..2956493 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -153,7 +153,6 @@ L.Map.Keyboard = L.Handler.extend({
 		this._setPanOffset(map.options.keyboardPanOffset);
 		this._setZoomOffset(map.options.keyboardZoomOffset);
 		this.modifier = 0;
-		this.dopagejump = 0;
 	},
 
 	addHooks: function () {
@@ -234,21 +233,6 @@ L.Map.Keyboard = L.Handler.extend({
 			}
 		}
 
-		// page up or page down, handled by this.dopagejump
-		// to jump back to the anchor from footnote/endnote by PgUp
-		// or jump back to the main text from header/footer by PgUp or PgDown
-		if (!this.modifier && (e.originalEvent.keyCode === 33 || e.originalEvent.keyCode === 34)) {
-			if (this.dopagejump === 1) {
-				return;
-			}
-			if (e.type === 'keyup') {
-				this.dopagejump = 1;
-			}
-		}
-		else if (e.type === 'keyup') {
-			this.dopagejump = 0;
-		}
-
 		var charCode = e.originalEvent.charCode;
 		var keyCode = e.originalEvent.keyCode;
 		var unoKeyCode = this._toUNOKeyCode(keyCode);
@@ -285,6 +269,10 @@ L.Map.Keyboard = L.Handler.extend({
 				e.originalEvent.preventDefault();
 			}
 		}
+		else if (!this.modifier && (e.originalEvent.keyCode === 33 || e.originalEvent.keyCode === 34)) {
+			// let the scrollbar handle page up / page down when viewing
+			return;
+		}
 		else if (e.type === 'keydown') {
 			var key = e.originalEvent.keyCode;
 			var map = this._map;


More information about the Libreoffice-commits mailing list