[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3-0' - loleaflet/src
Michael Meeks
michael.meeks at collabora.com
Wed Jan 17 11:14:50 UTC 2018
loleaflet/src/map/handler/Map.Keyboard.js | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
New commits:
commit 035db689b2b2f7401d7abc138f068e2774d69bfa
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Wed Jan 17 10:49:52 2018 +0000
Ensure we have the docLayer object as 'this' in _postKeyboardEvent.
Interestingly, we can have a 'this' that is not this object, that
means that this._clientVisibleArea is undefined, so page-up/down
don't work.
Fixes regression introduced by d1c8de9bf9021dedb67446439f117b1b64c7e2d9
Change-Id: If83b3542f17c1856af18c5c302e9d566761aeb12
Reviewed-on: https://gerrit.libreoffice.org/48039
Reviewed-by: pranavk <pranavk at collabora.co.uk>
Tested-by: pranavk <pranavk at collabora.co.uk>
diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js
index 23c55f21..f37d4d87 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -242,9 +242,11 @@ L.Map.Keyboard = L.Handler.extend({
return;
}
var docLayer = this._map._docLayer;
+ var eventObject;
if (!postEventFn) {
// default is to post keyboard events on the document
postEventFn = docLayer._postKeyboardEvent;
+ eventObject = docLayer;
}
this.modifier = 0;
var shift = e.originalEvent.shiftKey ? this.keyModifier.shift : 0;
@@ -315,7 +317,7 @@ L.Map.Keyboard = L.Handler.extend({
if (this.modifier) {
unoKeyCode |= this.modifier;
if (e.type !== 'keyup' && (this.modifier !== shift || (keyCode === 32 && !docLayer._isCursorVisible))) {
- postEventFn.call(this, 'input', charCode, unoKeyCode);
+ postEventFn.call(eventObject, 'input', charCode, unoKeyCode);
e.originalEvent.preventDefault();
return;
}
@@ -329,7 +331,7 @@ L.Map.Keyboard = L.Handler.extend({
this._bufferedTextInputEvent = null;
if (this._handleOnKeyDown(keyCode, this.modifier) && charCode === 0) {
- postEventFn.call(this, 'input', charCode, unoKeyCode);
+ postEventFn.call(eventObject, 'input', charCode, unoKeyCode);
}
}
else if ((e.type === 'keypress' || e.type === 'compositionend') &&
@@ -347,10 +349,10 @@ L.Map.Keyboard = L.Handler.extend({
if (e.type === 'compositionend') {
// Set all keycodes to zero
for (var i = 0; i < compCharCodes.length; ++i) {
- postEventFn.call(this, 'input', compCharCodes[i], 0);
+ postEventFn.call(eventObject, 'input', compCharCodes[i], 0);
}
} else {
- postEventFn.call(this, 'input', charCode, unoKeyCode);
+ postEventFn.call(eventObject, 'input', charCode, unoKeyCode);
}
this._keyHandled = true;
@@ -380,10 +382,10 @@ L.Map.Keyboard = L.Handler.extend({
var textInputData = this._bufferedTextInputEvent.originalEvent.data;
charCode = e.originalEvent.keyCode;
for (var i = 0; i < textInputData.length; i++) {
- postEventFn.call(this, 'input', textInputData[i].charCodeAt(), 0);
+ postEventFn.call(eventObject, 'input', textInputData[i].charCodeAt(), 0);
}
}
- postEventFn.call(this, 'up', charCode, unoKeyCode);
+ postEventFn.call(eventObject, 'up', charCode, unoKeyCode);
this._keyHandled = true;
this._bufferedTextInputEvent = null;
@@ -409,7 +411,7 @@ L.Map.Keyboard = L.Handler.extend({
else if (key in this._panKeys && e.originalEvent.shiftKey &&
docLayer._selections.getLayers().length !== 0) {
// if there is a selection and the user wants to modify it
- postEventFn.call(this, 'input', charCode, unoKeyCode);
+ postEventFn.call(eventObject, 'input', charCode, unoKeyCode);
}
else if (key in this._zoomKeys) {
map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]);
More information about the Libreoffice-commits
mailing list