[Libreoffice-commits] online.git: loleaflet/src
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 26 07:22:08 UTC 2020
loleaflet/src/control/Control.LokDialog.js | 8 +++++---
loleaflet/src/layer/tile/TileLayer.js | 15 ++++++++++++---
loleaflet/src/map/Map.js | 5 +++++
3 files changed, 22 insertions(+), 6 deletions(-)
New commits:
commit 63605979d855e1599feb50f19eb824b3d64610df
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Mar 25 23:17:03 2020 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Mar 26 08:21:49 2020 +0100
leaflet: don't steal focus from the Formula-Bar
This fixes an odd focus-stealing bug that resulted
in the text being typed backward (characters were
added towards the left).
To reproduce, select a cell with text, click into
the Formula-Bar. Immediately the focus is stolen
by the document (the cell), which is annoying.
Next, if the cursor is actually inserted in the
middle of the text, new characters are added to
the left of the cursor!
After fixing the above issues, it turned out
that simply moving the mouse into the document
stole the focus from the Formula-Bar (actually,
the Formula-Bar lost the focus but the document
doesn't get it).
A related change is that the mouse-leave logic
for the sidebar should not be applied to other
dialogs, so now we only handle that event for
the sidebar.
Change-Id: I8ed3f6b08e99e9379e1bfe51f34f5d2f6ed22483
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91085
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 5529abece..675526299 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -926,12 +926,14 @@ L.Control.LokDialog = L.Control.extend({
if (!this.isCalcInputBar(id) || window.mode.isDesktop()) {
this._setupWindowEvents(id, panelCanvas/*, dlgInput*/);
- L.DomEvent.on(panelContainer, 'mouseleave', function () {
+ if (this._isSidebar(id)) {
// Move the mouse off-screen when we leave the sidebar
// so we don't leave edge-elements highlighted as if
// the mouse is still over them.
- this._postWindowMouseEvent('move', id, -1, -1, 1, 0, 0);
- }, this);
+ L.DomEvent.on(panelContainer, 'mouseleave', function () {
+ this._postWindowMouseEvent('move', id, -1, -1, 1, 0, 0);
+ }, this);
+ }
}
// Render window.
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index a7d436ac0..c40b2fd3d 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1173,9 +1173,9 @@ L.TileLayer = L.GridLayer.extend({
if (!this._map.editorHasFocus() && this._map._isCursorVisible && (modifierViewId === this._viewId) && (this._map._permission === 'edit')) {
// Regain cursor if we had been out of focus and now have input.
- // (only if it is our own cursor and the input is actually not
- // going into a dialog)
- this._map.fire('editorgotfocus');
+ // Unless the focus is in the Calc Formula-Bar, don't steal the focus.
+ if (!this._map.calcInputBarHasFocus())
+ this._map.fire('editorgotfocus');
}
//first time document open, set last cursor position
@@ -2040,6 +2040,15 @@ L.TileLayer = L.GridLayer.extend({
_postMouseEvent: function(type, x, y, count, buttons, modifier) {
+ if (this.isCalc() && !this._map.editorHasFocus()) {
+ // When the Formula-bar has the focus, sending
+ // mouse move with the document coordinates
+ // hides the cursor (lost focus?). This is clearly
+ // a bug in Core, but we need to work around it
+ // until fixed. Just don't send mouse move.
+ return;
+ }
+
this._sendClientZoom();
this._sendClientVisibleArea();
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 34f3cc9a7..af4967ae2 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -880,6 +880,11 @@ L.Map = L.Evented.extend({
return this.getWinId() === 0;
},
+ // Returns true iff the formula-bar has the focus.
+ calcInputBarHasFocus: function () {
+ return !this.editorHasFocus() && this._activeDialog && this._activeDialog.isCalcInputBar(this.getWinId());
+ },
+
// TODO replace with universal implementation after refactoring projections
getZoomScale: function (toZoom, fromZoom) {
More information about the Libreoffice-commits
mailing list