summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2020-01-06 13:26:03 -0400
committerHenry Castro <hcastro@collabora.com>2020-01-06 19:40:59 +0100
commit697595ee223599669e8c1b577491da5fc8d71d02 (patch)
treecac083b1c7dd0e8a18b678f02600ace5a69ebcc1
parent23ccef0ac790aedb54c0eaff2ad6c814fc26d5c6 (diff)
loleaflet: mobile: avoid blurs when graphic is editing
This fixes the annoying effect to blur and focus again when the graphic is editing. Change-Id: I3b26cf0a3aaa6418062121279f65df3753e179a6 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86289 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Henry Castro <hcastro@collabora.com>
-rw-r--r--loleaflet/src/map/handler/Map.TouchGesture.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index f59604c82..66c333791 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -305,11 +305,12 @@ L.Map.TouchGesture = L.Handler.extend({
this._map.fire('closepopups');
this._map.fire('closemobilewizard');
+ var docLayer = this._map._docLayer;
// unselect if anything is selected already
- if (this._map._docLayer && this._map._docLayer._annotations && this._map._docLayer._annotations.unselect) {
- this._map._docLayer._annotations.unselect();
- var pointPx = this._map._docLayer._twipsToPixels(mousePos);
- var bounds = this._map._docLayer._annotations.getBounds();
+ if (docLayer && docLayer._annotations && docLayer._annotations.unselect) {
+ docLayer._annotations.unselect();
+ var pointPx = docLayer._twipsToPixels(mousePos);
+ var bounds = docLayer._annotations.getBounds();
if (bounds && bounds.contains(pointPx)) {
// not forward mouse events to core if the user tap on a comment box
// for instance on Writer that causes the text cursor to be moved
@@ -317,13 +318,16 @@ L.Map.TouchGesture = L.Handler.extend({
}
}
this._map._contextMenu._onMouseDown({originalEvent: e.srcEvent});
- this._map._docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 1, 0);
- this._map._docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 1, 0);
- if (this._state === L.Map.TouchGesture.MARKER || this._state === L.Map.TouchGesture.GRAPHIC) {
- this._map._textInput.blur();
- } else {
- this._map.focus();
+ if (docLayer) {
+ docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 1, 0);
+ docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 1, 0);
+
+ if (this._state === L.Map.TouchGesture.MARKER || (this._state === L.Map.TouchGesture.GRAPHIC && !docLayer._isCursorVisible)) {
+ this._map._textInput.blur();
+ } else if (!this._map.hasFocus()) {
+ this._map.focus();
+ }
}
},