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 2ca01188531d6ff499c5c1c19157903287a06317 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Fri Jul 3 15:42:09 2020 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Tue Aug 11 21:45:23 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> Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100550 diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js index 934b4b179..3468d8e2e 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, @@ -165,6 +162,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 cc02e444d..dc7573d28 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 5fdc1520d..37e703de9 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -155,12 +155,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