loleaflet/src/control/Control.PartsPreview.js |   13 +++++++----
 loleaflet/src/layer/tile/ImpressTileLayer.js  |   30 --------------------------
 loleaflet/src/map/Map.js                      |    6 -----
 3 files changed, 9 insertions(+), 40 deletions(-)

New commits:
commit 937823cd4a5af7477818893ee6bb306cf4acd46e
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Fri Jul 3 15:42:09 2020 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Tue Jul 7 17:28:27 2020 +0200

    loleaflet: re-creates the scrollbar when orientation changes
    
    We are manually changing the orientation CSS class name for
    preview thumbnails, so it requires to destroy and create again
    the custom scroll with the new axis to show a vertical or
    horizontal scroll bar
    
    Change-Id: Ib341025da66db05f6feddbbb32a286da107cd8df
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97898
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Henry Castro <hcas...@collabora.com>

diff --git a/loleaflet/src/control/Control.PartsPreview.js 
b/loleaflet/src/control/Control.PartsPreview.js
index cab7805d6..7500bbbb4 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -42,11 +42,8 @@ L.Control.PartsPreview = L.Control.extend({
                map.on('docsize', this._updateAllPreview, this);
        },
 
-       createScrollbar: function (axis) {
+       createScrollbar: function () {
                var control = this;
-               if (axis) {
-                       this._direction = axis;
-               }
 
                $(this._partsPreviewCont).mCustomScrollbar({
                        axis: this._direction,
@@ -163,6 +160,14 @@ L.Control.PartsPreview = L.Control.extend({
                        var previewFrame = 
$(this._partsPreviewCont).find('.preview-frame');
                        previewFrame.removeClass(removePreviewFrame);
                        previewFrame.addClass(addPreviewFrame);
+
+                       // re-create scrollbar with new direction
+                       var direction = this._direction;
+                       this._direction = !window.mode.isDesktop() && 
L.DomUtil.isPortrait() ? 'x' : 'y';
+                       if (direction !== this._direction) {
+                               
$(this._partsPreviewCont).mCustomScrollbar('destroy');
+                               this.createScrollbar();
+                       }
                }
        },
 
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js 
b/loleaflet/src/layer/tile/ImpressTileLayer.js
index b24ee5ccf..5063cc817 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -48,7 +48,6 @@ L.ImpressTileLayer = L.TileLayer.extend({
                map.on('AnnotationSave', this.onAnnotationSave, this);
                map.on('AnnotationScrollUp', this.onAnnotationScrollUp, this);
                map.on('AnnotationScrollDown', this.onAnnotationScrollDown, 
this);
-               map.on('orientationchange', this.onOrientationChange, this);
                map.on('resize', this.onResize, this);
 
                map.uiManager.initializeSpecializedUI('presentation');
@@ -255,35 +254,6 @@ L.ImpressTileLayer = L.TileLayer.extend({
                }
        },
 
-       onOrientationChange: function () {
-               var container = L.DomUtil.get('presentation-controls-wrapper');
-               var preview = L.DomUtil.get('slide-sorter');
-
-               if (!container || !preview) {
-                       return;
-               }
-
-               // Android change the orientation if the keyboard is visible
-               if (L.Browser.android) {
-                       if (window.innerHeight < 2 * screen.height / 3) {
-                               
L.DomUtil.addClass(this._map.options.documentContainer, 'keyboard');
-                               $(preview).hide();
-                       } else {
-                               
L.DomUtil.removeClass(this._map.options.documentContainer, 'keyboard');
-                               $(preview).show();
-                       }
-               }
-
-               if (L.DomUtil.isPortrait() && $(preview).data('mCS').opt.axis 
!== 'x') {
-                       $(preview).mCustomScrollbar('destroy');
-                       this._preview.createScrollbar('x');
-               } else if (L.DomUtil.isLandscape() && 
$(preview).data('mCS').opt.axis !== 'y') {
-                       $(preview).mCustomScrollbar('destroy');
-                       this._preview.createScrollbar('y');
-               }
-
-       },
-
        onUpdatePermission: function (e) {
                if (window.mode.isMobile()) {
                        if (e.perm === 'edit') {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 0cd8f9282..66103df1c 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -161,12 +161,6 @@ L.Map = L.Evented.extend({
                this._textInput = L.textInput();
                this.addLayer(this._textInput);
 
-               if (window.mode.isMobile()) {
-                       L.DomEvent.on(window, 'resize', function(e) {
-                               this.fire('orientationchange', e);
-                       }, this);
-               }
-
                // When all these conditions are met, fire 
statusindicator:initializationcomplete
                this.initConditions = {
                        'doclayerinit': false,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to