[Libreoffice-commits] online.git: loleaflet/css loleaflet/src
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 4 07:08:48 UTC 2019
loleaflet/css/loleaflet.css | 4 ++++
loleaflet/src/control/Control.Menubar.js | 11 ++++++++++-
loleaflet/src/control/Ruler.js | 1 +
loleaflet/src/map/Map.js | 21 +++++++++++++++++++++
4 files changed, 36 insertions(+), 1 deletion(-)
New commits:
commit 0576a3cced4c27be940a831d6735ece533a2a47d
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon May 13 21:13:15 2019 +0200
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Tue Jun 4 09:08:30 2019 +0200
Add "Show ruler" menu entry
Also add some space between the ruler and the document frame
Change-Id: I75a3e4668d03cf44b235082cd7d8c24672209262
Reviewed-on: https://gerrit.libreoffice.org/72339
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index 576931f8d..55a64dae3 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -30,6 +30,10 @@
cursor: default;
}
+.hasruler {
+ padding-top: 16px;
+}
+
.scroll-container .mCSB_scrollTools.mCSB_1_scrollbar {
position: absolute;
z-index: 1000;
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 4da0b7d51..bb2e32c7f 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -61,6 +61,7 @@ L.Control.Menubar = L.Control.extend({
{name: _UNO('.uno:ZoomPlus', 'text'), id: 'zoomin', type: 'action'},
{name: _UNO('.uno:ZoomMinus', 'text'), id: 'zoomout', type: 'action'},
{name: _('Reset zoom'), id: 'zoomreset', type: 'action'},
+ {name: _('Show Ruler'), id: 'showruler', type: 'action'},
{type: 'separator'},
{uno: '.uno:ControlCodes'}
]
@@ -646,12 +647,12 @@ L.Control.Menubar = L.Control.extend({
var aItem = this;
var type = $(aItem).data('type');
var id = $(aItem).data('id');
+ var constChecked = 'lo-menu-item-checked';
if (self._map._permission === 'edit') {
if (type === 'unocommand') { // enable all depending on stored commandStates
var data, lang;
var constUno = 'uno';
var constState = 'stateChangeHandler';
- var constChecked = 'lo-menu-item-checked';
var constLanguage = '.uno:LanguageStatus';
var constPageHeader = '.uno:InsertPageHeader';
var constPageFooter = '.uno:InsertPageFooter';
@@ -694,6 +695,12 @@ L.Control.Menubar = L.Control.extend({
if (index > 0) {
self.options.allowedViewModeActions.splice(index, 1);
}
+ } else if (id === 'showruler') {
+ if (self._map.isRulerVisible()) {
+ $(aItem).addClass(constChecked);
+ } else {
+ $(aItem).removeClass(constChecked);
+ }
} else {
$(aItem).removeClass('disabled');
}
@@ -751,6 +758,8 @@ L.Control.Menubar = L.Control.extend({
this._map.setZoom(this._map.options.zoom);
} else if (id === 'fullscreen') {
L.toggleFullScreen();
+ } else if (id === 'showruler') {
+ this._map.toggleRuler();
} else if (id === 'fullscreen-presentation' && this._map.getDocType() === 'presentation') {
this._map.fire('fullscreen');
} else if (id === 'insertpage') {
diff --git a/loleaflet/src/control/Ruler.js b/loleaflet/src/control/Ruler.js
index a48dacb6f..029b690a0 100644
--- a/loleaflet/src/control/Ruler.js
+++ b/loleaflet/src/control/Ruler.js
@@ -26,6 +26,7 @@ L.Control.Ruler = L.Control.extend({
map.on('docsize', this._updatePaintTimer, this);
map.on('scrolloffset resize', this._fixOffset, this);
map.on('updatepermission', this._changeInteractions, this);
+ $('#map').addClass('hasruler');
this._map = map;
return this._initLayout();
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index c1eba3297..b419b9201 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -1506,6 +1506,27 @@ L.Map = L.Evented.extend({
this.showMenubar();
else
this.hideMenubar();
+ },
+
+ showRuler: function() {
+ $('.loleaflet-ruler').show();
+ $('#map').addClass('hasruler');
+ },
+
+ hideRuler: function() {
+ $('.loleaflet-ruler').hide();
+ $('#map').removeClass('hasruler');
+ },
+
+ toggleRuler: function() {
+ if (this.isRulerVisible())
+ this.hideRuler();
+ else
+ this.showRuler();
+ },
+
+ isRulerVisible: function() {
+ return $('.loleaflet-ruler').is(':visible');
}
});
More information about the Libreoffice-commits
mailing list