diff options
author | Tor Lillqvist <tml@collabora.com> | 2020-03-26 10:42:32 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2020-03-26 10:13:02 +0100 |
commit | 3a5d193fdc699ee7056f50eab34b91da15bff037 (patch) | |
tree | 3a6a7fc2bbe26600e486cb45eb570865ce385991 /loleaflet/js/global.js | |
parent | 63605979d855e1599feb50f19eb824b3d64610df (diff) |
Move the window.mode.* functions to global.js for clarity
No idea why they were in Control.Toolbar.js.
Change-Id: I18ab812317b4bfb71d0c63a4cb2283d4fbaa3b54
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91087
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'loleaflet/js/global.js')
-rw-r--r-- | loleaflet/js/global.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js index a08c4cf3b..a4fd77bab 100644 --- a/loleaflet/js/global.js +++ b/loleaflet/js/global.js @@ -141,6 +141,25 @@ retina: (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1 }; + global.mode = { + // Here "mobile" means "mobile phone" (at least for now). Has to match small screen size + // requirement. + isMobile: function() { + if (L.Browser.mobile && L.Browser.cypressTest) { + return true; + } + + return L.Browser.mobile && screen.width < 768; + }, + // Mobile device with big screen size. + isTablet: function() { + return L.Browser.mobile && !window.mode.isMobile(); + }, + isDesktop: function() { + return !L.Browser.mobile; + } + }; + document.addEventListener('contextmenu', function(e) { if (e.preventDefault) { e.preventDefault(); |