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

Jan Holesovsky kendy at collabora.com
Sat Jan 9 14:53:28 PST 2016


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

New commits:
commit f646733006123e182ccb5f49d676086b0b2797bb
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 4587641..697dc3d 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -158,7 +158,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 () {
@@ -260,21 +259,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);
@@ -311,6 +295,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