[Libreoffice-commits] online.git: loleaflet/src

Henry Castro hcastro at collabora.com
Thu Mar 2 02:09:00 UTC 2017


 loleaflet/src/layer/AnnotationManager.js  |    3 ++-
 loleaflet/src/layer/marker/Annotation.js  |   10 ++++++++--
 loleaflet/src/layer/tile/CalcTileLayer.js |    3 ++-
 3 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit a1ed658080aae44d9cc6fd011ad533dd8a915146
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Mar 1 22:10:23 2017 -0400

    loleaflet: enable annotation pop-up menu
    
    Change-Id: I670987359261b27d0b081ea2bd803b3fbb43d7dc

diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index bb9aa2e..5c7d4ba 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -19,7 +19,8 @@ L.AnnotationManager = L.Class.extend({
 		this._map.on('AnnotationSave', this._onAnnotationSave, this);
 		var that = this;
 		$.contextMenu({
-			selector: '.loleaflet-annotation-content',
+			selector: '.loleaflet-annotation-menu',
+			trigger: 'none',
 			className: 'loleaflet-font',
 			items: {
 				modify: {
diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index 4ff80dd..a181e79 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -92,9 +92,9 @@ L.Annotation = L.Layer.extend({
 		L.DomUtil.create('div', 'loleaflet-annotation-userline', tdImg);
 		this._contentAuthor = L.DomUtil.create('div', 'loleaflet-annotation-content-author', tdAuthor);
 		this._contentDate = L.DomUtil.create('div', 'loleaflet-annotation-date', tdAuthor);
-		L.DomUtil.create('div', 'loleaflet-annotation-menu', tdMenu);
+		var divMenu = L.DomUtil.create('div', 'loleaflet-annotation-menu', tdMenu);
+		divMenu.annotation = this;
 		this._contentNode = L.DomUtil.create('div', 'loleaflet-annotation-content', wrapper);
-		this._contentNode.annotation = this;
 		this._editNode = L.DomUtil.create('div', 'loleaflet-annotation-edit', wrapper);
 		this._contentText = L.DomUtil.create('div', '', this._contentNode);
 		this._editText = L.DomUtil.create('textarea', 'loleaflet-annotation-textarea', this._editNode);
@@ -129,6 +129,12 @@ L.Annotation = L.Layer.extend({
 	},
 
 	_onMouseClick: function (e) {
+		var target = e.target || e.srcElement;
+		L.DomEvent.stopPropagation(e);
+		if (L.DomUtil.hasClass(target, 'loleaflet-annotation-menu')) {
+			$(target).contextMenu();
+			return;
+		}
 		L.DomEvent.stopPropagation(e);
 		this._map.fire('AnnotationClick', {annotation: this});
 	},
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index 3b34c4a..000d795 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -67,7 +67,8 @@ L.CalcTileLayer = L.TileLayer.extend({
 		L.TileLayer.prototype.onAdd.call(this, map);
 		this._annotations = {};
 		$.contextMenu({
-			selector: '.loleaflet-annotation-content',
+			selector: '.loleaflet-annotation-menu',
+			trigger: 'none',
 			className: 'loleaflet-font',
 			items: {
 				modify: {


More information about the Libreoffice-commits mailing list