[Libreoffice-commits] online.git: loleaflet/src
Mihai Varga
mihai.varga at collabora.com
Fri Jun 26 02:04:26 PDT 2015
loleaflet/src/layer/tile/TileLayer.js | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
New commits:
commit 56418272ca04b38933db30affa7f0f8166851200
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Fri Jun 26 12:04:04 2015 +0300
Fixed keyCode on chrome
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 8dfd007..8b58104 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -755,15 +755,18 @@ L.TileLayer = L.GridLayer.extend({
return;
}
- if (e.type === 'keydown') {
- this._keyEvent = null;
- }
- else if (e.type === 'keypress') {
- this._keyEvent = e.originalEvent;
- this._postKeyboardEvent('input', this._keyEvent.charCode, this._toUNOKeyCode(this._keyEvent.keyCode));
- }
- else if (e.type === 'keyup' && this._keyEvent) {
- this._postKeyboardEvent('up', this._keyEvent.charCode, this._toUNOKeyCode(this._keyEvent.keyCode));
+ var charCode = e.originalEvent.charCode;
+ var keyCode = e.originalEvent.keyCode;
+ if (e.type === 'keypress') {
+ if (charCode === keyCode && charCode !== 13) {
+ // Chrome sets keyCode = charCode for printable keys
+ // while LO requires it to be 0
+ keyCode = 0;
+ }
+ this._postKeyboardEvent('input', charCode, this._toUNOKeyCode(keyCode));
+ }
+ else if (e.type === 'keyup') {
+ this._postKeyboardEvent('up', charCode, this._toUNOKeyCode(keyCode));
}
},
More information about the Libreoffice-commits
mailing list