loleaflet/src/layer/tile/CalcTileLayer.js |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 6da38c824440d444b45b6144ff088db367487d51
Author: Henry Castro <hcas...@collabora.com>
Date:   Sun Mar 26 10:11:27 2017 -0400

    loleaflet: fix when an annotation is removed from Calc documents
    
    Calc server does not respond with cellPos property when an annotation
    is removed
    
    Change-Id: I7c15e112c549f10277fb2fb51bc12b3f16f5fc88

diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js 
b/loleaflet/src/layer/tile/CalcTileLayer.js
index 35877c64..0dd18011 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -162,10 +162,10 @@ L.CalcTileLayer = L.TileLayer.extend({
                if (textMsg.startsWith('comment:')) {
                        var obj = 
JSON.parse(textMsg.substring('comment:'.length + 1));
                        obj.comment.tab = obj.comment.id.substring(0, 
obj.comment.id.indexOf('.'));
-                       obj.comment.cellPos = 
L.LOUtil.stringToBounds(obj.comment.cellPos);
-                       obj.comment.cellPos = 
L.latLngBounds(this._twipsToLatLng(obj.comment.cellPos.getBottomLeft()),
-                               
this._twipsToLatLng(obj.comment.cellPos.getTopRight()));
                        if (obj.comment.action === 'Add') {
+                               obj.comment.cellPos = 
L.LOUtil.stringToBounds(obj.comment.cellPos);
+                               obj.comment.cellPos = 
L.latLngBounds(this._twipsToLatLng(obj.comment.cellPos.getBottomLeft()),
+                                       
this._twipsToLatLng(obj.comment.cellPos.getTopRight()));
                                if (!this._annotations[obj.comment.tab]) {
                                        this._annotations[obj.comment.tab] = {};
                                }
@@ -177,10 +177,13 @@ L.CalcTileLayer = L.TileLayer.extend({
                                var removed = 
this._annotations[obj.comment.tab][obj.comment.id];
                                if (removed) {
                                        this.hideAnnotation(removed);
-                                       delete 
annotations[obj.comment.tab][obj.comment.id];
+                                       delete 
this._annotations[obj.comment.tab][obj.comment.id];
                                }
                        } else if (obj.comment.action === 'Modify') {
                                var modified = 
this._annotations[obj.comment.tab][obj.comment.id];
+                               obj.comment.cellPos = 
L.LOUtil.stringToBounds(obj.comment.cellPos);
+                               obj.comment.cellPos = 
L.latLngBounds(this._twipsToLatLng(obj.comment.cellPos.getBottomLeft()),
+                                       
this._twipsToLatLng(obj.comment.cellPos.getTopRight()));
                                if (modified) {
                                        modified._annotation._data = 
obj.comment;
                                        
modified.setLatLngBounds(obj.comment.cellPos);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to