loleaflet/src/layer/tile/CalcTileLayer.js    |    5 +----
 loleaflet/src/layer/tile/ImpressTileLayer.js |    6 ++++++
 loleaflet/src/layer/tile/TileLayer.js        |    4 ++++
 loleaflet/src/layer/tile/WriterTileLayer.js  |    7 +++++++
 loleaflet/src/map/Map.js                     |    3 +++
 5 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit 3844cd3a82a09c0a97ab5b27bb9367c288825dc8
Author: Pranav Kant <pran...@collabora.co.uk>
Date:   Fri Feb 2 14:42:44 2018 +0530

    loleaflet: Remove comments, changes on doc disconnect
    
    Change-Id: Iccad2afe8a8ddf85fd83577c1d1b822724ce318a
    (cherry picked from commit ef05eb36e4d4b3d70afc83ca5b267e23e46bf3e4)
    (cherry picked from commit db5083b08eaea805173658321b76a26b5d50f481)
    Reviewed-on: https://gerrit.libreoffice.org/49135
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js 
b/loleaflet/src/layer/tile/CalcTileLayer.js
index d0296b15..a485746d 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -48,9 +48,7 @@ L.CalcTileLayer = L.TileLayer.extend({
 
        clearAnnotations: function () {
                for (var tab in this._annotations) {
-                       for (var key in this._annotations[tab]) {
-                               
this.hideAnnotation(this._annotations[tab][key]);
-                       }
+                       this.hideAnnotations(tab);
                }
                this._annotations = {};
        },
@@ -99,7 +97,6 @@ L.CalcTileLayer = L.TileLayer.extend({
        },
 
        hideAnnotations: function (part) {
-
                var annotations = this._annotations[part];
                for (var key in annotations) {
                        this.hideAnnotation(annotations[key]);
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js 
b/loleaflet/src/layer/tile/ImpressTileLayer.js
index b8731417..3e97c11d 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -41,6 +41,12 @@ L.ImpressTileLayer = L.TileLayer.extend({
                return null;
        },
 
+       clearAnnotations: function() {
+               for (var part in this._partHashes) {
+                       this.hideAnnotations(part);
+               }
+       },
+
        hideAnnotations: function (part) {
                this._selectedAnnotation = undefined;
                var annotations = this._annotations[this._partHashes[part]];
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 16ac17b3..0ac34006 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -286,6 +286,10 @@ L.TileLayer = L.GridLayer.extend({
                map.fire('statusindicator', {statusType: 'loleafletloaded'});
        },
 
+       clearAnnotations: function() {
+               console.debug('Implemented in child  classes');
+       },
+
        getEvents: function () {
                var events = {
                        viewreset: this._viewReset,
diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js 
b/loleaflet/src/layer/tile/WriterTileLayer.js
index b88b60b8..6c1a886b 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -16,6 +16,13 @@ L.WriterTileLayer = L.TileLayer.extend({
                }
        },
 
+       clearAnnotations: function() {
+               if (this._annotations) {
+                       this._annotations.clear();
+                       this._annotations.clearChanges();
+               }
+       },
+
        onRemove: function (map) {
                map.off('updatemaxbounds', this._onUpdateMaxBounds, this);
        },
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 6c5d8f71..2e9054f4 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -166,6 +166,9 @@ L.Map = L.Evented.extend({
                                } else {
                                        this._activate();
                                }
+                       } else {
+                               // remove the comments and changes
+                               this._docLayer.clearAnnotations();
                        }
                }, this);
        },
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to