[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - loleaflet/src

mert (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 16 07:52:02 UTC 2020


 loleaflet/src/layer/marker/Annotation.js      |    6 +--
 loleaflet/src/map/handler/Map.TouchGesture.js |   45 ++++++++++++++++++++------
 2 files changed, 38 insertions(+), 13 deletions(-)

New commits:
commit 94e461f8248341f9a24de2b2dc77777cc48a755a
Author:     mert <mert.tumer at collabora.com>
AuthorDate: Fri Sep 11 17:05:30 2020 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Sep 16 09:51:44 2020 +0200

    Fix annotation kebab menu brings up keyboard on mobile
    
    Also fixed other weirdnesses on touch event with
    annotation box. It was sending click events to
    LOK even if we click on annotation box, which is not
    wanted.
    
    Change-Id: Ia43a879c72c22276c482e463fa725ce1c76df911
    Signed-off-by: mert <mert.tumer at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102468
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index b5c7f3069..bcf3ab74d 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -203,7 +203,7 @@ L.Annotation = L.Layer.extend({
 		var tr = L.DomUtil.create('tr', empty, tbody);
 		var tdImg = L.DomUtil.create(tagTd, 'loleaflet-annotation-img', tr);
 		var tdAuthor = L.DomUtil.create(tagTd, 'loleaflet-annotation-author', tr);
-		var imgAuthor = L.DomUtil.create('img', 'avatar-img', tdImg);
+		var imgAuthor = L.DomUtil.create('img', 'avatar-img loleaflet-annotation-avatar-img', tdImg);
 		imgAuthor.setAttribute('src', L.LOUtil.getImageURL('user.svg'));
 		imgAuthor.setAttribute('width', this.options.imgSize.x);
 		imgAuthor.setAttribute('height', this.options.imgSize.y);
@@ -238,12 +238,12 @@ L.Annotation = L.Layer.extend({
 		}
 		if (this._data.trackchange) {
 			this._captionNode = L.DomUtil.create(tagDiv, 'loleaflet-annotation-caption', wrapper);
-			this._captionText = L.DomUtil.create(tagDiv, empty, this._captionNode);
+			this._captionText = L.DomUtil.create(tagDiv, 'loleaflet-annotation-caption-text', this._captionNode);
 		}
 		this._contentNode = L.DomUtil.create(tagDiv, 'loleaflet-annotation-content loleaflet-dont-break', wrapper);
 		this._nodeModify = L.DomUtil.create(tagDiv, classEdit, wrapper);
 		this._nodeModifyText = L.DomUtil.create(tagTextArea, classTextArea, this._nodeModify);
-		this._contentText = L.DomUtil.create(tagDiv, empty, this._contentNode);
+		this._contentText = L.DomUtil.create(tagDiv, 'loleaflet-annotation-content-text', this._contentNode);
 		this._nodeReply = L.DomUtil.create(tagDiv, classEdit, wrapper);
 		this._nodeReplyText = L.DomUtil.create(tagTextArea, classTextArea, this._nodeReply);
 
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index 4257c0212..677d15dec 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -320,20 +320,27 @@ L.Map.TouchGesture = L.Handler.extend({
 		}
 
 		this._map.fire('closepopups');
-		this._map.fire('editorgotfocus');
 
 		var docLayer = this._map._docLayer;
-		// unselect if anything is selected already
-		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
-				return;
+		if (docLayer && docLayer._annotations) {
+			var annotationClicked = false;
+			if (e.target) {
+				var className = e.target.className;
+				if (className && typeof className === 'string') {
+					if (className.indexOf('annotation') >= 0) {
+						annotationClicked = true;
+						return;
+					}
+				}
+			}
+			// unselect if anything is selected already
+			if (!annotationClicked && docLayer._annotations.unselect) {
+				docLayer._annotations.unselect();
 			}
 		}
+
+		this._map.fire('editorgotfocus');
+
 		this._map._contextMenu._onMouseDown({originalEvent: e.srcEvent});
 
 		var acceptInput = false; // No keyboard by default.
@@ -378,6 +385,24 @@ L.Map.TouchGesture = L.Handler.extend({
 
 		var docLayer = this._map._docLayer;
 		if (docLayer) {
+			if (docLayer._annotations) {
+				var annotationClicked = false;
+				if (e.target) {
+					var className = e.target.className;
+					if (className) {
+						if (className && typeof className === 'string') {
+							if (className.indexOf('annotation') >= 0) {
+								annotationClicked = true;
+								return;
+							}
+						}
+					}
+				}
+				// unselect if anything is selected already
+				if (!annotationClicked && docLayer._annotations.unselect) {
+					docLayer._annotations.unselect();
+				}
+			}
 			if (docLayer._docType === 'spreadsheet' && !docLayer.hasGraphicSelection()) {
 				// Enter cell-edit mode on double-taping a cell.
 				if (this._map.isPermissionEdit()) {


More information about the Libreoffice-commits mailing list