loleaflet/src/layer/AnnotationManager.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
New commits: commit 6108fabea34ac83e81f8aff853b9cbc5cc1faf0b Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Jun 7 12:19:36 2019 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Fri Jun 7 12:20:38 2019 +0200 Multiple annotations switching active class Change-Id: I54ab4660842b069d5198a7b4933d46e3078484f1 Reviewed-on: https://gerrit.libreoffice.org/73652 Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Tested-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js index a4a4d2754..eba39f4ef 100644 --- a/loleaflet/src/layer/AnnotationManager.js +++ b/loleaflet/src/layer/AnnotationManager.js @@ -243,8 +243,9 @@ L.AnnotationManager = L.Class.extend({ unselect: function () { if (this._selected) { - if ($(this._selected._container).hasClass('annotation-active')) + if (this._selected && $(this._selected._container).hasClass('annotation-active')) $(this._selected._container).removeClass('annotation-active'); + this._selected = null; this.update(); } @@ -254,9 +255,15 @@ L.AnnotationManager = L.Class.extend({ if (annotation) { // Select the root comment var idx = this.getRootIndexOf(annotation._data.id); + + if (this._selected && $(this._selected._container).hasClass('annotation-active')) + $(this._selected._container).removeClass('annotation-active'); + this._selected = this._items[idx]; - if (!$(this._selected._container).hasClass('annotation-active')) + + if (this._selected && !$(this._selected._container).hasClass('annotation-active')) $(this._selected._container).addClass('annotation-active'); + this.update(); } }, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits