loleaflet/src/control/Control.MobileWizard.js |   46 ++++++++++++++++++++++++--
 loleaflet/src/layer/tile/ImpressTileLayer.js  |   17 ---------
 2 files changed, 44 insertions(+), 19 deletions(-)

New commits:
commit e1ca1d6831233bfbc77cbcc2932b1cdf1ea46c09
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Tue Aug 25 02:59:13 2020 +0530
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Sep 9 14:23:57 2020 +0200

    leaflet: hide slide pane when mobile wizard visible
    
    now slide pane would be only visible over slide property wizard
    
    removed in other cases because it used to take up valuable space
    
    Change-Id: I68e10aefab15680fba52feb577cbeae048a337bc
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101296
    Tested-by: Andras Timar <andras.ti...@collabora.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/loleaflet/src/control/Control.MobileWizard.js 
b/loleaflet/src/control/Control.MobileWizard.js
index 1cd965865..b51311b5d 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -121,6 +121,8 @@ L.Control.MobileWizard = L.Control.extend({
                if (window.pageMobileWizard === true)
                        window.pageMobilewizard = false;
 
+               if (this.isMobileWizardHeaderVisible)
+                       this._removeMobileWizardHeader();
 
                this._updateToolbarItemStateByClose();
 
@@ -351,8 +353,8 @@ L.Control.MobileWizard = L.Control.extend({
                                window.mobileDialogId = data.id;
                        }
 
-                       if (this.map.getDocType() === 'presentation')
-                               $('#mobile-wizard-header').show();
+                       if (this.map.getDocType() === 'presentation' && 
this._isSlidePropertyPanel(data))
+                               this._addMobileWizardHeader();
 
                        this._isActive = true;
                        var currentPath = null;
@@ -427,6 +429,46 @@ L.Control.MobileWizard = L.Control.extend({
                }
        },
 
+       _addMobileWizardHeader: function() {
+               if (!this.isMobileWizardHeaderVisible) {
+                       var map = this._map;
+                       this.isMobileWizardHeaderVisible = true;
+                       L.Control.MobileWizard.mergeOptions({maxHeight: '55%'});
+                       var mobileWizard = L.DomUtil.get('mobile-wizard');
+                       var mobileWizardContent = 
L.DomUtil.get('mobile-wizard-content');
+                       var container = L.DomUtil.createWithId('div', 
'mobile-wizard-header', mobileWizard);
+                       var preview = L.DomUtil.createWithId('div', 
'mobile-slide-sorter', container);
+                       L.DomUtil.toBack(container);
+                       map.addControl(L.control.partsPreview(container, 
preview, {
+                               fetchThumbnail: false,
+                               allowOrientation: false,
+                               axis: 'x',
+                               imageClass: 'preview-img-portrait',
+                               frameClass: 'preview-frame-portrait'
+                       }));
+                       L.DomUtil.addClass(mobileWizardContent, 
'with-slide-sorter-above');
+               }
+       },
+
+       _removeMobileWizardHeader: function() {
+               if (this.isMobileWizardHeaderVisible) {
+                       this.isMobileWizardHeaderVisible = false;
+                       L.Control.MobileWizard.mergeOptions({maxHeight: '45%'});
+                       $('#mobile-wizard-header').remove();
+                       var mobileWizardContent = 
L.DomUtil.get('mobile-wizard-content');
+                       L.DomUtil.removeClass(mobileWizardContent, 
'with-slide-sorter-above');
+               }
+       },
+
+       _isSlidePropertyPanel: function(data) {
+               try {
+                       var panels = data.children[0].children;
+                       return panels[0].id === 'SlideBackgroundPanel' && 
panels[1].id === 'SdLayoutsPanel';
+               } catch (e) {
+                       return false;
+               }
+       },
+
        _insertCalcBorders: function(deck) {
                var replaceMe = L.LOUtil.findItemWithAttributeRecursive(deck, 
'id', 'cellbordertype');
                if (replaceMe) {
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js 
b/loleaflet/src/layer/tile/ImpressTileLayer.js
index a8d8a2522..8112cd1fb 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -30,23 +30,6 @@ L.ImpressTileLayer = L.TileLayer.extend({
 
                this._annotationManager = L.annotationManagerImpress(map);
                map.uiManager.initializeSpecializedUI('presentation');
-
-               if (window.mode.isMobile()) {
-                       L.Control.MobileWizard.mergeOptions({maxHeight: '55%'});
-                       var mobileWizard = L.DomUtil.get('mobile-wizard');
-                       var mobileWizardContent = 
L.DomUtil.get('mobile-wizard-content');
-                       var container = L.DomUtil.createWithId('div', 
'mobile-wizard-header', mobileWizard);
-                       var preview = L.DomUtil.createWithId('div', 
'mobile-slide-sorter', container);
-                       L.DomUtil.toBack(container);
-                       map.addControl(L.control.partsPreview(container, 
preview, {
-                               fetchThumbnail: false,
-                               allowOrientation: false,
-                               axis: 'x',
-                               imageClass: 'preview-img-portrait',
-                               frameClass: 'preview-frame-portrait'
-                       }));
-                       L.DomUtil.addClass(mobileWizardContent, 
'with-slide-sorter-above');
-               }
        },
 
        getAnnotation: function (id) {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to