loleaflet/src/layer/AnnotationManagerImpress.js |   11 +++++++----
 loleaflet/src/layer/marker/Annotation.js        |   16 +++++++++++++---
 2 files changed, 20 insertions(+), 7 deletions(-)

New commits:
commit 701ee977ed8081d209b49f68e6cec592253cd45b
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Mon Jul 20 13:14:05 2020 +0200
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Tue Jul 21 18:35:10 2020 +0200

    remove annotations properly not leaving lines or markers behind
    
    Change-Id: I2de8620176724746e8fde0c190edba10109f057e
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99120
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/loleaflet/src/layer/AnnotationManagerImpress.js 
b/loleaflet/src/layer/AnnotationManagerImpress.js
index 473adec06..ef92c665f 100644
--- a/loleaflet/src/layer/AnnotationManagerImpress.js
+++ b/loleaflet/src/layer/AnnotationManagerImpress.js
@@ -91,8 +91,6 @@ L.AnnotationManagerImpress = L.AnnotationManagerBase.extend({
                }
        },
        unselectAnnotations: function() {
-               this._selectedForPopup = null;
-               this._map.removeLayer(this._selectionLine);
                this.onAnnotationCancel();
        },
        _onAnnotationZoom: function () {
@@ -100,15 +98,20 @@ L.AnnotationManagerImpress = 
L.AnnotationManagerBase.extend({
        },
        _onAnnotationSelect: function (event) {
                this._selectedForPopup = event.annotation;
-               this.onAnnotationCancel();
+               this._map.focus();
+               this.layoutAnnotations();
        },
        onAnnotationCancel: function () {
                if (this._draft) {
                        this._map.removeLayer(this._draft);
                        this._draft = null;
                }
-               this._map.focus();
                this._selectedAnnotation = undefined;
+               if (this._selectedForPopup) {
+                       this._map.removeLayer(this._selectionLine);
+                       this._selectedForPopup = null;
+               }
+               this._map.focus();
                this.layoutAnnotations();
        },
        onAnnotationModify: function (annotation) {
diff --git a/loleaflet/src/layer/marker/Annotation.js 
b/loleaflet/src/layer/marker/Annotation.js
index 5f66d8f2a..f60b7b680 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -43,6 +43,8 @@ L.Annotation = L.Layer.extend({
                        this._data.textSelected.removeEventParent(map);
                        map.removeLayer(this._data.textSelected);
                }
+               this.hideMarker();
+               this._annotationMarker = null;
                this._map = null;
        },
 
@@ -91,9 +93,7 @@ L.Annotation = L.Layer.extend({
                if (this._data.textSelected && this._map.hasLayer && 
!this._map.hasLayer(this._data.textSelected)) {
                        this._map.addLayer(this._data.textSelected);
                }
-               if (this._annotationMarker != null) {
-                       this._map.addLayer(this._annotationMarker);
-               }
+               this.showMarker();
        },
 
        hide: function () {
@@ -104,6 +104,16 @@ L.Annotation = L.Layer.extend({
                if (this._data.textSelected && 
this._map.hasLayer(this._data.textSelected)) {
                        this._map.removeLayer(this._data.textSelected);
                }
+               this.hideMarker();
+       },
+
+       showMarker: function () {
+               if (this._annotationMarker != null) {
+                       this._map.addLayer(this._annotationMarker);
+               }
+       },
+
+       hideMarker: function () {
                if (this._annotationMarker != null) {
                        this._map.removeLayer(this._annotationMarker);
                }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to