[Libreoffice-commits] online.git: loleaflet/src

Tor Lillqvist tml at collabora.com
Wed Jul 4 11:30:07 UTC 2018


 loleaflet/src/map/Map.js |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 23c7c7d2a950f9857bed196569ad50b60243f99b
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Jul 4 13:24:34 2018 +0300

    Don't show the ruler if the window has too small height
    
    Of course, for this to really be worthy of being called "responsive"
    web design, we should update this decision also if the window is
    re-sized dynamically, like when a desktop browser's window is
    arbitrarily re-sized by the user, or a mobile device is rotated
    between portrait and landscape orientation, or a mobile device enters
    or leaves some kind of split-screen mode where another application
    than the browser shares the display.
    
    Also, it would be nice if the window height limit used here, 1280, was
    some kind of global variable. (For width limits used to detect mobile
    devices, we use 768 or 768px here and there in our JS code. (And,
    interestingly, 767px, too.) Ideally this 1280 and those 768s should be
    defined in some common place. No idea how to do that correctly in
    JavaScript.
    
    Change-Id: I02bb54f309bc116ae1a0b5264e72b9ba674f56e4
    Reviewed-on: https://gerrit.libreoffice.org/56936
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 609153900..83183bb3f 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -118,7 +118,9 @@ L.Map = L.Evented.extend({
 			if (!this.initComplete) {
 				this._fireInitComplete('doclayerinit');
 			}
-			if (this._docLayer._docType == 'text') {
+			// 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') {
 				var interactiveRuler = this._permission === 'edit' ? true : false;
 				L.control.ruler({position:'topleft', interactive:interactiveRuler}).addTo(this);
 			}


More information about the Libreoffice-commits mailing list