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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Aug 26 18:26:48 UTC 2018


 loleaflet/src/control/Control.Scroll.js |   86 ++++++++++++++++----------------
 1 file changed, 44 insertions(+), 42 deletions(-)

New commits:
commit 4d5fa8f83314ed6969734a57581573cf4d15396d
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Sun Aug 26 12:02:25 2018 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Sun Aug 26 14:26:10 2018 -0400

    loleaflet: mobile: disable scroll bars
    
    Change-Id: I82b3872b7354717937e9adc4c8ae5e8d582834ea

diff --git a/loleaflet/src/control/Control.Scroll.js b/loleaflet/src/control/Control.Scroll.js
index 56a10a314..ead1a68a3 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -17,48 +17,50 @@ L.Control.Scroll = L.Control.extend({
 		this._prevDocWidth = 0;
 		this._prevDocHeight = 0;
 
-		map.on('scrollto', this._onScrollTo, this);
-		map.on('scrollby', this._onScrollBy, this);
-		map.on('scrollvelocity', this._onScrollVelocity, this);
-		map.on('handleautoscroll', this._onHandleAutoScroll, this);
-		map.on('docsize', this._onUpdateSize, this);
-		map.on('updatescrolloffset', this._onUpdateScrollOffset, this);
-		map.on('updaterowcolumnheaders', this._onUpdateRowColumnHeaders, this);
-
-		var control = this;
-		var autoHideTimeout = null;
-		$('.scroll-container').mCustomScrollbar({
-			axis: 'yx',
-			theme: 'minimal-dark',
-			scrollInertia: 0,
-			advanced:{autoExpandHorizontalScroll: true}, /* weird bug, it should be false */
-			callbacks:{
-				onScrollStart: function() {
-					control._map.fire('closepopup');
-				},
-				onScroll: function() {
-					control._onScrollEnd(this);
-					if (autoHideTimeout)
-						clearTimeout(autoHideTimeout);
-					autoHideTimeout = setTimeout(function() {
-						//	$('.mCS-autoHide > .mCustomScrollBox ~ .mCSB_scrollTools').css({opacity: 0, 'filter': 'alpha(opacity=0)', '-ms-filter': 'alpha(opacity=0)'});
-						$('.mCS-autoHide > .mCustomScrollBox ~ .mCSB_scrollTools').removeClass('loleaflet-scrollbar-show');
-					}, 2000);
-				},
-				whileScrolling: function() {
-					control._onScroll(this);
-
-					// autoHide feature doesn't work because plugin relies on hovering on scroll container
-					// and we have a mock scroll container whereas the actual user hovering happens only on
-					// real document. Change the CSS rules manually to simulate autoHide feature.
-					$('.mCS-autoHide > .mCustomScrollBox ~ .mCSB_scrollTools').addClass('loleaflet-scrollbar-show');
-				},
-				onUpdate: function() {
-					console.debug('mCustomScrollbar: onUpdate:');
-				},
-				alwaysTriggerOffsets: false
-			}
-		});
+		if (!L.Browser.mobile) {
+			map.on('scrollto', this._onScrollTo, this);
+			map.on('scrollby', this._onScrollBy, this);
+			map.on('scrollvelocity', this._onScrollVelocity, this);
+			map.on('handleautoscroll', this._onHandleAutoScroll, this);
+			map.on('docsize', this._onUpdateSize, this);
+			map.on('updatescrolloffset', this._onUpdateScrollOffset, this);
+			map.on('updaterowcolumnheaders', this._onUpdateRowColumnHeaders, this);
+
+			var control = this;
+			var autoHideTimeout = null;
+			$('.scroll-container').mCustomScrollbar({
+				axis: 'yx',
+				theme: 'minimal-dark',
+				scrollInertia: 0,
+				advanced:{autoExpandHorizontalScroll: true}, // weird bug, it should be false
+				callbacks:{
+					onScrollStart: function() {
+						control._map.fire('closepopup');
+					},
+					onScroll: function() {
+						control._onScrollEnd(this);
+						if (autoHideTimeout)
+							clearTimeout(autoHideTimeout);
+						autoHideTimeout = setTimeout(function() {
+							//	$('.mCS-autoHide > .mCustomScrollBox ~ .mCSB_scrollTools').css({opacity: 0, 'filter': 'alpha(opacity=0)', '-ms-filter': 'alpha(opacity=0)'});
+							$('.mCS-autoHide > .mCustomScrollBox ~ .mCSB_scrollTools').removeClass('loleaflet-scrollbar-show');
+						}, 2000);
+					},
+					whileScrolling: function() {
+						control._onScroll(this);
+
+						// autoHide feature doesn't work because plugin relies on hovering on scroll container
+						// and we have a mock scroll container whereas the actual user hovering happens only on
+						// real document. Change the CSS rules manually to simulate autoHide feature.
+						$('.mCS-autoHide > .mCustomScrollBox ~ .mCSB_scrollTools').addClass('loleaflet-scrollbar-show');
+					},
+					onUpdate: function() {
+						console.debug('mCustomScrollbar: onUpdate:');
+					},
+					alwaysTriggerOffsets: false
+				}
+			});
+		}
 	},
 
 	_onCalcScroll: function (e) {


More information about the Libreoffice-commits mailing list