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

Pranav Kant pranavk at collabora.co.uk
Mon May 22 11:24:16 UTC 2017


 loleaflet/src/control/Control.Scroll.js |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 62680fffdb2843ae8a82fa2d3b54e2256ef86d41
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon May 22 16:51:52 2017 +0530

    loleaflet: Change opacity manually
    
    See inline comment
    
    Change-Id: I62456dd300eabaa156f9673fe13c190421c22ca0

diff --git a/loleaflet/src/control/Control.Scroll.js b/loleaflet/src/control/Control.Scroll.js
index 3bbb5c5c..03bdcb77 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -2,7 +2,7 @@
  * L.Control.Scroll handles scrollbars
  */
 
-/* global $ */
+/* global $ clearTimeout setTimeout */
 L.Control.Scroll = L.Control.extend({
 
 	onAdd: function (map) {
@@ -25,6 +25,7 @@ L.Control.Scroll = L.Control.extend({
 		map.on('updaterowcolumnheaders', this._onUpdateRowColumnHeaders, this);
 
 		var control = this;
+		var autoHideTimeout = null;
 		$('.scroll-container').mCustomScrollbar({
 			axis: 'yx',
 			theme: 'minimal-dark',
@@ -33,9 +34,19 @@ L.Control.Scroll = L.Control.extend({
 			callbacks:{
 				onScroll: function() {
 					control._onScrollEnd(this);
+					if (autoHideTimeout)
+						clearTimeout(autoHideTimeout);
+					autoHideTimeout = setTimeout(function() {
+						$('.mCS-autoHide > .mCustomScrollBox .mCSB_scrollTools, .mCS-autoHide > .mCustomScrollBox ~ .mCSB_scrollTools').css({opacity: 0, 'filter': 'alpha(opacity=0)', '-ms-filter': 'alpha(opacity=0)'});
+					}, 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, .mCS-autoHide > .mCustomScrollBox ~ .mCSB_scrollTools').css({opacity: 1, 'filter': 'alpha(opacity=100)', '-ms-filter': 'alpha(opacity=100)'});
 				},
 				onUpdate: function() {
 					console.debug('mCustomScrollbar: onUpdate:');


More information about the Libreoffice-commits mailing list