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 3a525c70c0a780a65b6488950a96b7f2b4bc1387
Author: Henry Castro <hcas...@collabora.com>
Date:   Wed Apr 19 21:11:28 2017 -0400

    loleaflet: add option no menu when insert new annotation
    
    Change-Id: I0950c743f9443f85674fb087c44c8fe942bcc322
    Reviewed-on: https://gerrit.libreoffice.org/36708
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jan Holesovsky <ke...@collabora.com>

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();
        },
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to