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

Mihai Varga mihai.varga at collabora.com
Mon Jun 29 08:51:29 PDT 2015


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

New commits:
commit 1acd0ab78d3c54f6fb29e0db73db2c362cafbd8a
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Mon Jun 29 18:42:20 2015 +0300

    Ignore scroll event when zooming
    
    That event is fired because of container resize.
    This time I've added a method that resets the ignoreScroll flag
    after 200ms if it's not reseted until then.

diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 64e3054..1ac09e7 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -386,11 +386,16 @@ L.GridLayer = L.Layer.extend({
 										 this._docHeightTwips / this._tileHeightTwips);
 		scrollPixelLimits = scrollPixelLimits.multiplyBy(this._tileSize);
 
+		if (!sizeChanged) {
+			this._ignoreScroll = true;
+			setTimeout(L.bind(function() {this._ignoreScroll = null;}, this), 200);
+		}
 		L.DomUtil.setStyle(this._map._mockDoc, 'width', scrollPixelLimits.x + 'px');
 		L.DomUtil.setStyle(this._map._mockDoc, 'height', scrollPixelLimits.y + 'px');
 	},
 
 	_updateScrollOffset: function () {
+		this._ignoreScroll = null;
 		if (this._map._scrollContainer.mcs) {
 			$('#scroll-container').mCustomScrollbar('stop');
 			var centerPixel = this._map.project(this._map.getCenter());
@@ -764,6 +769,9 @@ L.GridLayer = L.Layer.extend({
 	},
 
 	_onScroll: function (evt) {
+		if (this._ignoreScroll) {
+			return;
+		}
 		if (this._prevScrollY === undefined) {
 			this._prevScrollY = 0;
 		}


More information about the Libreoffice-commits mailing list