loleaflet/src/control/Control.Menubar.js |   12 +++++++++++-
 loleaflet/src/control/Ruler.js           |    5 ++++-
 loleaflet/src/layer/AnnotationManager.js |   10 ++--------
 3 files changed, 17 insertions(+), 10 deletions(-)

New commits:
commit e2c4dd28d4129723564652620dec149d08d1d53e
Author:     Scott Clarke <scott.cla...@codethink.co.uk>
AuthorDate: Tue Sep 3 11:49:35 2019 +0100
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
CommitDate: Mon Sep 30 07:11:02 2019 +0200

    Make changes to "Resolved Comments" view menu option
    
    The check mark for resolved comments in the view menu
    is now dependent on the state of the javascript variable
    rather than the other way around. This brings it in line
    with how other similar menu options work.
    
    Also fixed ruler so that it looks correct when there are
    comments on the document which are all hidden.
    
    Change-Id: I636260da3d053799b53363e9412a0b367e3a9274
    Reviewed-on: https://gerrit.libreoffice.org/78775
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
    Tested-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>

diff --git a/loleaflet/src/control/Control.Menubar.js 
b/loleaflet/src/control/Control.Menubar.js
index e55d53f5a..714dd177e 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -744,6 +744,16 @@ L.Control.Menubar = L.Control.extend({
                                                } else {
                                                        
$(aItem).removeClass('disabled');
                                                }
+                                       } else if (id === 'showresolved') {
+                                               if 
(self._map._docLayer._annotations._items.length === 0) {
+                                                       
$(aItem).addClass('disabled');
+                                               } else if 
(self._map._docLayer._annotations._showResolved) {
+                                                       
$(aItem).removeClass('disabled');
+                                                       
$(aItem).addClass(constChecked);
+                                               } else {
+                                                       
$(aItem).removeClass('disabled');
+                                                       
$(aItem).removeClass(constChecked);
+                                               }
                                        } else {
                                                
$(aItem).removeClass('disabled');
                                        }
@@ -802,7 +812,7 @@ L.Control.Menubar = L.Control.extend({
                } else if (id === 'zoomin' && this._map.getZoom() < 
this._map.getMaxZoom()) {
                        this._map.zoomIn(1);
                } else if (id === 'showresolved') {
-                       this._map.showResolvedComments(item);
+                       
this._map.showResolvedComments(!$(item).hasClass('lo-menu-item-checked'));
                } else if (id === 'zoomout' && this._map.getZoom() > 
this._map.getMinZoom()) {
                        this._map.zoomOut(1);
                } else if (id === 'zoomreset') {
diff --git a/loleaflet/src/control/Ruler.js b/loleaflet/src/control/Ruler.js
index 029b690a0..f00522797 100644
--- a/loleaflet/src/control/Ruler.js
+++ b/loleaflet/src/control/Ruler.js
@@ -85,7 +85,10 @@ L.Control.Ruler = L.Control.extend({
                if (this.options.margin1 == null || this.options.margin2 == 
null)
                        return;
 
-               if (this._map._docLayer._annotations._items.length === 0 || 
!this.options.marginSet)
+               if (this._map._docLayer._annotations._items.length === 0
+               || this._map._docLayer._annotations._items.length
+               === this._map._docLayer._annotations._hiddenItems
+               || !this.options.marginSet)
                        this.options.extraSize = 0;
 
                var classMajorSep = 'loleaflet-ruler-maj',
diff --git a/loleaflet/src/layer/AnnotationManager.js 
b/loleaflet/src/layer/AnnotationManager.js
index da1161f06..54336b041 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -995,16 +995,10 @@ L.Map.include({
                });
        },
 
-       showResolvedComments: function(item) {
+       showResolvedComments: function(on) {
                var unoCommand = '.uno:ShowResolvedAnnotations';
-               var on = $(item).hasClass('lo-menu-item-checked');
                this.sendUnoCommand(unoCommand);
-               this._docLayer._annotations.setViewResolved(!on);
-               if (on) {
-                       $(item).removeClass('lo-menu-item-checked');
-               } else {
-                       $(item).addClass('lo-menu-item-checked');
-               }
+               this._docLayer._annotations.setViewResolved(on);
        }
 });
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to