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 <t...@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 <hcas...@collabora.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@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. */ +@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); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits