[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - loleaflet/dist loleaflet/src

Tor Lillqvist tml at collabora.com
Wed Jul 4 14:16:06 UTC 2018


 loleaflet/dist/leaflet.css |   10 +++++++---
 loleaflet/src/map/Map.js   |    6 +-----
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 874b54a193c462a147a370e35f7b84ec4ca363e3
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Jul 4 16:51:14 2018 +0300

    Better and more dynamic way to show ruler conditionally
    
    Use conditional CSS, setting the ruler height to zero if it would be
    too high. Now the ruler even shows up and disappears dynamically as
    the window height changes, for instance when turning a mobile device
    between landscape and portrait orientation. No JS conditional needed
    after all.
    
    Change-Id: I9046d8b9535de60902142a1fc6e45dd6f4c5e5a0
    Reviewed-on: https://gerrit.libreoffice.org/56951
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css
index 6cee86cf2..d42802bef 100644
--- a/loleaflet/dist/leaflet.css
+++ b/loleaflet/dist/leaflet.css
@@ -775,14 +775,18 @@ 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;
 	}
 
+/* The 20px above is 5% of the 400px below. */
+ at media screen and (max-height: 400px) {
+	.loleaflet-ruler {
+		height: 0px;
+	}
+}
+
 .loleaflet-ruler-breakcontainer {
 	height: 100%;
 	position: absolute;
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 1791e240e..b3ef7730b 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -117,11 +117,7 @@ L.Map = L.Evented.extend({
 			if (!this.initComplete) {
 				this._fireInitComplete('doclayerinit');
 			}
-			// 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') {
+			if (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