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

Henry Castro hcastro at collabora.com
Thu Apr 20 01:11:45 UTC 2017


 loleaflet/src/layer/AnnotationManager.js     |    3 ++-
 loleaflet/src/layer/marker/Annotation.js     |   13 ++++++++-----
 loleaflet/src/layer/tile/CalcTileLayer.js    |    3 ++-
 loleaflet/src/layer/tile/ImpressTileLayer.js |    2 +-
 4 files changed, 13 insertions(+), 8 deletions(-)

New commits:
commit b142e0ba48fbee0f7b7a7d0b0ce32693b8224c4b
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Apr 19 21:11:28 2017 -0400

    loleaflet: add option no menu when insert new annotation
    
    Change-Id: I0950c743f9443f85674fb087c44c8fe942bcc322

diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index 54f3496b..05ad8416 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -365,7 +365,8 @@ L.AnnotationManager = L.Class.extend({
 	},
 
 	add: function (comment) {
-		var annotation = L.annotation(this._map.options.maxBounds.getSouthEast(), comment).addTo(this._map);
+		var annotation = L.annotation(this._map.options.maxBounds.getSouthEast(), comment,
+			comment.id === 'new' ? {noMenu: true} : {}).addTo(this._map);
 		if (comment.parent && comment.parent > '0') {
 			var parentIdx = this.getIndexOf(comment.parent);
 			this._items.splice(parentIdx + 1, 0, annotation);
diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index 97b2d8e9..abed0b01 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -6,7 +6,8 @@ L.Annotation = L.Layer.extend({
 	options: {
 		minWidth: 160,
 		maxHeight: 50,
-		imgSize: L.point([32, 32])
+		imgSize: L.point([32, 32]),
+		noMenu: false
 	},
 
 	initialize: function (latlng, data, options) {
@@ -167,10 +168,12 @@ L.Annotation = L.Layer.extend({
 			}, this);
 		}
 
-		var tdMenu = L.DomUtil.create(tagTd, 'loleaflet-annotation-menubar', tr);
-		var divMenu = L.DomUtil.create(tagDiv, this._data.trackchange ? 'loleaflet-annotation-menu-redline' : 'loleaflet-annotation-menu', tdMenu);
-		divMenu.title = _('Open menu');
-		divMenu.annotation = this;
+		if (this.options.noMenu !== true) {
+			var tdMenu = L.DomUtil.create(tagTd, 'loleaflet-annotation-menubar', tr);
+			var divMenu = L.DomUtil.create(tagDiv, this._data.trackchange ? 'loleaflet-annotation-menu-redline' : 'loleaflet-annotation-menu', tdMenu);
+			divMenu.title = _('Open menu');
+			divMenu.annotation = this;
+		}
 		if (this._data.trackchange) {
 			this._captionNode = L.DomUtil.create(tagDiv, 'loleaflet-annotation-caption', wrapper);
 			this._captionText = L.DomUtil.create(tagDiv, empty, this._captionNode);
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index d0e300bf..80c009d4 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -32,7 +32,8 @@ L.CalcTileLayer = L.TileLayer.extend({
 	},
 
 	createAnnotation: function (comment) {
-		var annotation = L.divOverlay(comment.cellPos).bindAnnotation(L.annotation(L.latLng(0, 0), comment));
+		var annotation = L.divOverlay(comment.cellPos).bindAnnotation(L.annotation(L.latLng(0, 0),
+			comment, comment.id === 'new' ? {noMenu: true} : {}));
 		annotation.mark = L.marker(comment.cellPos.getNorthEast(), {
 			draggable: false,
 			clickable: false,
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index 09f8707f..859ef679 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -6,7 +6,7 @@
 L.ImpressTileLayer = L.TileLayer.extend({
 
 	newAnnotation: function (comment) {
-		var annotation = L.annotation(this._map.getCenter(), comment).addTo(this._map);
+		var annotation = L.annotation(this._map.getCenter(), comment, {noMenu: true}).addTo(this._map);
 		annotation.edit();
 		annotation.focus();
 	},


More information about the Libreoffice-commits mailing list