[Libreoffice-commits] online.git: loleaflet/src

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 4 21:27:55 UTC 2019


 loleaflet/src/layer/tile/ImpressTileLayer.js |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

New commits:
commit 7dbb6e4f386c09f61ed06a55669cadfcd5340716
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Mon Nov 4 09:29:30 2019 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Mon Nov 4 22:27:36 2019 +0100

    loleaflet: mobile: recreate the scrollbar on 'orientationchange' event
    
    The "mCustomScrollbar" was created the scrollbar dynamically, so when
    the user change the orientation, it is necessary to destroy the scrollbar and
    create again with the new respective axis.
    
    Change-Id: Ic4d90de6e9989478f5d60254692b287c76368385
    Reviewed-on: https://gerrit.libreoffice.org/82016
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index b5e74a5ac..fd2ee785b 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -46,6 +46,7 @@ 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);
 		if (window.mode.isMobile()) {
 			this.onMobileInit(map);
@@ -415,6 +416,25 @@ L.ImpressTileLayer = L.TileLayer.extend({
 		}
 	},
 
+	onOrientationChange: function () {
+		var container = L.DomUtil.get('presentation-controls-wrapper');
+		var preview = L.DomUtil.get('slide-sorter');
+		var control = $(preview).data('preview');
+
+		if (!container || !preview || !control) {
+			return;
+		}
+
+		if (L.DomUtil.isPortrait() && $(preview).data('mCS').opt.axis !== 'x') {
+			$(preview).mCustomScrollbar('destroy');
+			control.createScrollbar('x');
+		} else if (L.DomUtil.isLandscape() && $(preview).data('mCS').opt.axis !== 'y') {
+			$(preview).mCustomScrollbar('destroy');
+			control.createScrollbar('y');
+		}
+
+	},
+
 	onUpdatePermission: function (e) {
 		if (window.mode.isMobile()) {
 			if (e.perm === 'edit') {


More information about the Libreoffice-commits mailing list