[Libreoffice-commits] online.git: loleaflet/css loleaflet/src
Tor Lillqvist
tml at collabora.com
Wed Jul 4 13:02:36 UTC 2018
loleaflet/css/leaflet.css | 3 +++
loleaflet/src/map/Map.js | 8 +++++---
2 files changed, 8 insertions(+), 3 deletions(-)
New commits:
commit 1800a8ee172ce60a1f5361d14ddf49e818dc7513
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Jul 4 15:59:09 2018 +0300
Decide whether to display a ruler based on ruler percentage of window height
If the ruler would be over 5% of the window height, don't display it.
Change-Id: Ieed55318fc76dfe0f9248985b816e306b6654dee
diff --git a/loleaflet/css/leaflet.css b/loleaflet/css/leaflet.css
index d1a615a50..6cee86cf2 100644
--- a/loleaflet/css/leaflet.css
+++ b/loleaflet/css/leaflet.css
@@ -775,6 +775,9 @@ input.clipboard {
.loleaflet-ruler {
background-color: #efefef;
+ /* If you change the below 20px, also change the window height limit
+ * in the doclayerinit thing in Map.js.
+ */
height: 20px;
width: 100vw;
margin: 0px;
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 83183bb3f..ed864093c 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -118,9 +118,11 @@ L.Map = L.Evented.extend({
if (!this.initComplete) {
this._fireInitComplete('doclayerinit');
}
- // Don't show the ruler if the window is small. Use 1280 pixels as the
- // fairly arbitrary limit.
- if ($(window).height() >= 1280 && this._docLayer._docType == 'text') {
+ // Don't show the ruler if the window is small. Use 5% of window height as
+ // the fairly arbitrary limit how high the ruler can be. We "know" (from
+ // leaflet.css, .loleaflet-ruler, height) that the ruler height is 20px.
+ // That makes the limit 400px.
+ if ($(window).height() >= 400 && this._docLayer._docType == 'text') {
var interactiveRuler = this._permission === 'edit' ? true : false;
L.control.ruler({position:'topleft', interactive:interactiveRuler}).addTo(this);
}
More information about the Libreoffice-commits
mailing list