loleaflet/js/global.js | 2 +- loleaflet/src/control/Control.Menubar.js | 12 ++++++------ loleaflet/src/control/Control.PartsPreview.js | 6 +++--- loleaflet/src/control/Control.Toolbar.js | 4 ++-- loleaflet/src/control/Permission.js | 6 +++--- loleaflet/src/layer/AnnotationManager.js | 2 +- loleaflet/src/layer/marker/Annotation.js | 2 +- loleaflet/src/layer/tile/CalcTileLayer.js | 2 +- loleaflet/src/layer/tile/GridLayer.js | 2 +- loleaflet/src/layer/tile/ImpressTileLayer.js | 2 +- loleaflet/src/layer/tile/WriterTileLayer.js | 2 +- loleaflet/src/map/Clipboard.js | 2 +- loleaflet/src/map/Map.js | 20 ++++++++++---------- 13 files changed, 32 insertions(+), 32 deletions(-)
New commits: commit f070a0ffd4450932e27b41ef3bdb1d86705cf694 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Wed Apr 8 14:15:22 2020 +0200 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Apr 10 13:12:07 2020 +0200 mobile, tablet: Even the small tablets or large phones should get the phone UI. There is clearly not enough space for the normal sidebar when one of the dimensions is below 768. Change-Id: Iac27f12f837b9e6a64d1cce7b8376009bbe2c15f Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92004 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js index a4fd77bab..3022d94a3 100644 --- a/loleaflet/js/global.js +++ b/loleaflet/js/global.js @@ -149,7 +149,7 @@ return true; } - return L.Browser.mobile && screen.width < 768; + return L.Browser.mobile && (screen.width < 768 || screen.height < 768); }, // Mobile device with big screen size. isTablet: function() { commit 7725c7f309f343c8db0ed19adfbfd667bf66573f Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Wed Apr 8 13:32:59 2020 +0200 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Apr 10 13:11:52 2020 +0200 mobile: Never use L.Browser.mobile, instead use window.mode.isXYZ(). The L.Browser detects the browser capabilities, but the window.mode.isMobile()/isTablet()/isDesktop() is what decides what form factor are we targeting in the particular instance of the Online. This commit tries to kill convert the L.Browser.mobile checks into the appropriate window.mode.isXYZ(), hope I got the intention right on most of the places - it wouldn't be correct to blindly convert everything to (isMobile() || isTablet()). Change-Id: I57430058ec15deb5f67f9c645d234f998fbf539d Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92003 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index f7aa69111..dac5d07d2 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -841,7 +841,7 @@ L.Control.Menubar = L.Control.extend({ var pageStyles = e.commandValues['HeaderFooter']; for (var iterator in pageStyles) { style = pageStyles[iterator]; - if (!L.Browser.mobile) { + if (!window.mode.isMobile()) { $menuHeader.append(this._createUnoMenuItem(_(style), constHeader + encodeURIComponent(style) + constArg, style)); $menuFooter.append(this._createUnoMenuItem(_(style), constFooter + encodeURIComponent(style) + constArg, style)); } else { @@ -897,12 +897,12 @@ L.Control.Menubar = L.Control.extend({ var $nav = $menu.parent(); if (this.checked) { self._map.fire('closesidebar'); - if (!L.Browser.mobile) { + if (!window.mode.isMobile()) { // Surely this code, if it really is related only to the hamburger menu, // will never be invoked on non-mobile browsers? I might be wrong though. // If you notice this logging, please modify this comment to indicate what is // going on. - console.log('======> Assertion failed!? Not L.Browser.mobile? Control.Menubar.js #1'); + console.log('======> Assertion failed!? Not window.mode.isMobile()? Control.Menubar.js #1'); $nav.css({height: 'initial', bottom: '38px'}); $menu.hide().slideDown(250, function() { $menu.css('display', ''); }); $('#mobile-wizard-header').show(); @@ -913,9 +913,9 @@ L.Control.Menubar = L.Control.extend({ $('#toolbar-hamburger').removeClass('menuwizard-closed').addClass('menuwizard-opened'); $('#mobile-wizard-header').hide(); } - } else if (!L.Browser.mobile) { + } else if (!window.mode.isMobile()) { // Ditto. - console.log('======> Assertion failed!? Not L.Browser.mobile? Control.Menubar.js #2'); + console.log('======> Assertion failed!? Not window.mode.isMobile()? Control.Menubar.js #2'); $menu.show().slideUp(250, function() { $menu.css('display', ''); }); $nav.css({height:'', bottom: ''}); } else { @@ -1233,7 +1233,7 @@ L.Control.Menubar = L.Control.extend({ self._executeAction(item); } - if (!L.Browser.mobile && $(item).data('id') !== 'insertcomment') + if (!window.mode.isMobile() && $(item).data('id') !== 'insertcomment') self._map.focus(); }, diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js index 22c81be19..fb794fe32 100644 --- a/loleaflet/src/control/Control.PartsPreview.js +++ b/loleaflet/src/control/Control.PartsPreview.js @@ -8,8 +8,8 @@ L.Control.PartsPreview = L.Control.extend({ options: { fetchThumbnail: true, autoUpdate: true, - maxWidth: L.Browser.mobile ? 60 : 180, - maxHeight: L.Browser.mobile ? 60 : 180 + maxWidth: (window.mode.isMobile() || window.mode.isTablet()) ? 60 : 180, + maxHeight: (window.mode.isMobile() || window.mode.isTablet()) ? 60 : 180 }, partsFocused: false, @@ -184,7 +184,7 @@ L.Control.PartsPreview = L.Control.extend({ img.hash = hashCode; img.src = L.Icon.Default.imagePath + '/preview_placeholder.png'; img.fetched = false; - if (L.Browser.mobile) { + if (window.mode.isMobile() || window.mode.isTablet()) { (new Hammer(img, {recognizers: [[Hammer.Press]]})) .on('press', L.bind(function () { if (this._map._permission === 'edit') { diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js index 21a434d56..7af0f6ce2 100644 --- a/loleaflet/src/control/Control.Toolbar.js +++ b/loleaflet/src/control/Control.Toolbar.js @@ -1711,7 +1711,7 @@ function onDocLayerInit() { _updateToolbarsVisibility(); - if (L.Browser.mobile) { + if (window.mode.isMobile() || window.mode.isTablet()) { nUsers = '%n'; oneUser = '1'; noUser = '0'; @@ -2676,7 +2676,7 @@ function setupToolbar(e) { if (!L.Params.closeButtonEnabled) { $('#closebuttonwrapper').hide(); - } else if (L.Params.closeButtonEnabled && !L.Browser.mobile) { + } else if (L.Params.closeButtonEnabled && !window.mode.isMobile()) { $('#closebuttonwrapper').show(); $('.closebuttonimage').show(); } diff --git a/loleaflet/src/control/Permission.js b/loleaflet/src/control/Permission.js index 283bfea69..e8fe959ca 100644 --- a/loleaflet/src/control/Permission.js +++ b/loleaflet/src/control/Permission.js @@ -6,7 +6,7 @@ L.Map.include({ setPermission: function (perm) { if (perm === 'edit') { - if (L.Browser.mobile) { + if (window.mode.isMobile() || window.mode.isTablet()) { var button = $('#mobile-edit-button'); button.show(); button.off('click'); @@ -30,7 +30,7 @@ L.Map.include({ } } else if (perm === 'view' || perm === 'readonly') { - if (L.Browser.mobile) { + if (window.mode.isMobile() || window.mode.isTablet()) { $('#mobile-edit-button').hide(); } @@ -39,7 +39,7 @@ L.Map.include({ }, _enterEditMode: function (perm) { - if (this._permission == 'readonly' && L.Browser.mobile) { + if (this._permission == 'readonly' && (window.mode.isMobile() || window.mode.isTablet())) { this.sendInitUNOCommands(); } this._permission = perm; diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js index 866cc700c..59d7ce867 100644 --- a/loleaflet/src/layer/AnnotationManager.js +++ b/loleaflet/src/layer/AnnotationManager.js @@ -924,7 +924,7 @@ L.AnnotationManager = L.Class.extend({ }, _updateScaling: function () { - if (!L.Browser.mobile || this._items.length === 0) + if (window.mode.isDesktop() || this._items.length === 0) return; var contentWrapperClassName, menuClassName; if (this._items[0]._data.trackchange) { diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js index 2ae65ef57..7029fe35e 100644 --- a/loleaflet/src/layer/marker/Annotation.js +++ b/loleaflet/src/layer/marker/Annotation.js @@ -410,7 +410,7 @@ L.Annotation = L.Layer.extend({ }, _updateScaling: function (scaleFactor, initialLayoutData) { - if (!L.Browser.mobile) + if (window.mode.isDesktop()) return; var wrapperWidth = Math.round(initialLayoutData.wrapperWidth * scaleFactor); diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js index 505b7f5de..da8b51a1d 100644 --- a/loleaflet/src/layer/tile/CalcTileLayer.js +++ b/loleaflet/src/layer/tile/CalcTileLayer.js @@ -50,7 +50,7 @@ L.CalcTileLayer = L.TileLayer.extend({ map.on('AnnotationCancel', this._onAnnotationCancel, this); map.on('AnnotationReply', this._onAnnotationReply, this); map.on('AnnotationSave', this._onAnnotationSave, this); - if (L.Browser.mobile) { + if (window.mode.isMobile() || window.mode.isTablet()) { this.onMobileInit(map); } }, diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js index 9a9d7f004..8e1a046ea 100644 --- a/loleaflet/src/layer/tile/GridLayer.js +++ b/loleaflet/src/layer/tile/GridLayer.js @@ -11,7 +11,7 @@ L.GridLayer = L.Layer.extend({ tileSize: window.tileSize, opacity: 1, - updateWhenIdle: L.Browser.mobile, + updateWhenIdle: (window.mode.isMobile() || window.mode.isTablet()), updateInterval: 200, attribution: null, diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js index 756f189a8..d2a8dc4c4 100644 --- a/loleaflet/src/layer/tile/ImpressTileLayer.js +++ b/loleaflet/src/layer/tile/ImpressTileLayer.js @@ -94,7 +94,7 @@ L.ImpressTileLayer = L.TileLayer.extend({ }, onResize: function () { - if (!L.Browser.mobile) { + if (window.mode.isDesktop()) { this._map.setView(this._map.getCenter(), this._map.getZoom(), {reset: true}); } diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js b/loleaflet/src/layer/tile/WriterTileLayer.js index 43ce0f917..bc34beadc 100644 --- a/loleaflet/src/layer/tile/WriterTileLayer.js +++ b/loleaflet/src/layer/tile/WriterTileLayer.js @@ -39,7 +39,7 @@ L.WriterTileLayer = L.TileLayer.extend({ }, beforeAdd: function (map) { - if (L.Browser.mobile) { + if (window.mode.isMobile() || window.mode.isTablet()) { this.onMobileInit(map); } }, diff --git a/loleaflet/src/map/Clipboard.js b/loleaflet/src/map/Clipboard.js index df07abf4d..7cd87a7cb 100644 --- a/loleaflet/src/map/Clipboard.js +++ b/loleaflet/src/map/Clipboard.js @@ -776,7 +776,7 @@ L.Clipboard = L.Class.extend({ _warnCopyPaste: function() { var self = this; var msg; - if (L.Browser.mobile) { + if (window.mode.isMobile() || window.mode.isTablet()) { msg = _('<p>Please use the copy/paste buttons on your on-screen keyboard.</p>'); } else { msg = _('<p>Your browser has very limited access to the clipboard, so use these keyboard shortcuts:<ul><li><b>Ctrl+C</b>: For copying.</li><li><b>Ctrl+X</b>: For cutting.</li><li><b>Ctrl+V</b>: For pasting.</li></ul></p>'); diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 744966962..f5699bca3 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -67,7 +67,7 @@ L.Map = L.Evented.extend({ this._onResize = L.bind(this._onResize, this); // Start with readonly toolbars on desktop - if (!L.Browser.mobile) { + if (window.mode.isDesktop()) { L.DomUtil.addClass(L.DomUtil.get('toolbar-wrapper'), 'readonly'); } @@ -130,7 +130,7 @@ L.Map = L.Evented.extend({ this.addHandler('keyboard', L.Map.Keyboard); this.addHandler('dragging', L.Map.Drag); - if ((L.Browser.touch && !L.Browser.pointer) || (L.Browser.cypressTest && L.Browser.mobile)) { + if ((L.Browser.touch && !L.Browser.pointer) || (L.Browser.cypressTest && (window.mode.isMobile() || window.mode.isTablet()))) { this.dragging.disable(); this.dragging._draggable._manualDrag = true; this._mainEvents('off'); @@ -149,7 +149,7 @@ L.Map = L.Evented.extend({ this._socket = L.socket(this); var center = this.getCenter(); - if (L.Browser.mobile) { + if (window.mode.isMobile() || window.mode.isTablet()) { var doubledProgressHeight = 200; var size = new L.point(screen.width, screen.height - doubledProgressHeight); center = this.layerPointToLatLng(size._divideBy(2)); @@ -182,7 +182,7 @@ L.Map = L.Evented.extend({ if (e.perm === 'readonly') { L.DomUtil.addClass(this._container.parentElement, 'readonly'); - if (!L.Browser.mobile) { + if (window.mode.isDesktop()) { L.DomUtil.addClass(L.DomUtil.get('toolbar-wrapper'), 'readonly'); } L.DomUtil.addClass(L.DomUtil.get('main-menu'), 'readonly'); @@ -190,7 +190,7 @@ L.Map = L.Evented.extend({ L.DomUtil.addClass(L.DomUtil.get('spreadsheet-row-column-frame'), 'readonly'); } else { L.DomUtil.removeClass(this._container.parentElement, 'readonly'); - if (!L.Browser.mobile) { + if (window.mode.isDesktop()) { L.DomUtil.removeClass(L.DomUtil.get('toolbar-wrapper'), 'readonly'); } L.DomUtil.removeClass(L.DomUtil.get('main-menu'), 'readonly'); @@ -202,7 +202,7 @@ L.Map = L.Evented.extend({ if (!this.initComplete) { this._fireInitComplete('doclayerinit'); } - if (((window.ThisIsTheiOSApp && window.mode.isTablet()) || !L.Browser.mobile) && this._docLayer._docType == 'text') { + if (((window.ThisIsTheiOSApp && window.mode.isTablet()) || window.mode.isDesktop()) && this._docLayer._docType == 'text') { var interactiveRuler = this._permission === 'edit' ? true : false; L.control.ruler({position:'topleft', interactive:interactiveRuler}).addTo(this); } @@ -301,7 +301,7 @@ L.Map = L.Evented.extend({ var map = this; setTimeout(function () { // Show the sidebar by default, but not on mobile. - if (!window.mode.isMobile() && !window.mode.isTablet() && !window.ThisIsAMobileApp) { + if (window.mode.isDesktop() && !window.ThisIsAMobileApp) { map._socket.sendMessage('uno .uno:SidebarShow'); } }, 200); @@ -1014,7 +1014,7 @@ L.Map = L.Evented.extend({ throw new Error('Map container is already initialized.'); } - if (!L.Browser.mobile) { + if (window.mode.isDesktop()) { this._resizeDetector = L.DomUtil.create('iframe', 'resize-detector', container); this._resizeDetector.contentWindow.addEventListener('touchstart', L.DomEvent.preventDefault, {passive: false}); L.DomEvent.on(this._resizeDetector.contentWindow, 'contextmenu', L.DomEvent.preventDefault); @@ -1243,7 +1243,7 @@ L.Map = L.Evented.extend({ } this._startInactiveTimer(); - if (!L.Browser.mobile) { + if (window.mode.isDesktop()) { this.focus(); } return vex.closeAll(); @@ -1254,7 +1254,7 @@ L.Map = L.Evented.extend({ } this._startInactiveTimer(); - if (!L.Browser.mobile && !isAnyVexDialogActive()) { + if (window.mode.isDesktop() && !isAnyVexDialogActive()) { this.focus(); } return false; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits