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

Pranam Lashkari (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 2 15:53:37 UTC 2020


 loleaflet/src/main.js                 |    1 
 loleaflet/src/map/Map.js              |    1 
 loleaflet/src/map/handler/Map.Drag.js |   63 +---------------------------------
 3 files changed, 3 insertions(+), 62 deletions(-)

New commits:
commit e30b03513646fa5587f677f6b84a59d153d1c234
Author:     Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Sun Mar 1 10:58:49 2020 +0530
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Mon Mar 2 16:53:19 2020 +0100

    leaflet: removed legacy inertia scrolling implementation
    
    Change-Id: I6be07f1d16ea6bcebfa9c8c2712b713c3f0b1950
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89772
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/src/main.js b/loleaflet/src/main.js
index ba500fd09..7fdbee43d 100644
--- a/loleaflet/src/main.js
+++ b/loleaflet/src/main.js
@@ -66,7 +66,6 @@ var map = L.map('map', {
 	alwaysActive: alwaysActive,
 	idleTimeoutSecs: idleTimeoutSecs,  // Dim when user is idle.
 	outOfFocusTimeoutSecs: outOfFocusTimeoutSecs, // Dim after switching tabs.
-	inertia: false
 });
 
 ////// Controls /////
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index a4804775d..97a8eb6b6 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -132,7 +132,6 @@ L.Map = L.Evented.extend({
 		this.addHandler('dragging', L.Map.Drag);
 		if ((L.Browser.touch && !L.Browser.pointer) || (L.Browser.cypressTest && L.Browser.mobile)) {
 			this.dragging.disable();
-			this.options.inertia = false;
 			this.dragging._draggable._manualDrag = true;
 			this._mainEvents('off');
 			this.addHandler('touchGesture', L.Map.TouchGesture);
diff --git a/loleaflet/src/map/handler/Map.Drag.js b/loleaflet/src/map/handler/Map.Drag.js
index e90082286..41170f24f 100644
--- a/loleaflet/src/map/handler/Map.Drag.js
+++ b/loleaflet/src/map/handler/Map.Drag.js
@@ -4,12 +4,7 @@
  */
 
 L.Map.mergeOptions({
-	dragging: true,
-
-	inertia: !L.Browser.android23,
-	inertiaDeceleration: 3400, // px/s^2
-	inertiaMaxSpeed: Infinity, // px/s
-	easeLinearity: 0.2,
+	dragging: true
 });
 
 L.Map.Drag = L.Handler.extend({
@@ -49,27 +44,9 @@ L.Map.Drag = L.Handler.extend({
 		map
 		    .fire('movestart')
 		    .fire('dragstart');
-
-		if (map.options.inertia) {
-			this._positions = [];
-			this._times = [];
-		}
 	},
 
 	_onDrag: function (e) {
-		if (this._map.options.inertia) {
-			var time = this._lastTime = +new Date(),
-			    pos = this._lastPos = this._draggable._absPos || this._draggable._newPos;
-
-			this._positions.push(pos);
-			this._times.push(time);
-
-			if (time - this._times[0] > 50) {
-				this._positions.shift();
-				this._times.shift();
-			}
-		}
-
 		this._map
 		    .fire('move', e)
 		    .fire('drag', e);
@@ -97,43 +74,9 @@ L.Map.Drag = L.Handler.extend({
 	},
 
 	_onDragEnd: function (e) {
-		var map = this._map,
-		    options = map.options,
-
-		    noInertia = !options.inertia || this._times.length < 2;
+		var map = this._map;
 
 		map.fire('dragend', e);
-
-		if (noInertia) {
-			map.fire('moveend');
-		} else {
-			var direction = this._lastPos.subtract(this._positions[0]),
-			    duration = (this._lastTime - this._times[0]) / 1000,
-			    ease = options.easeLinearity,
-
-			    speedVector = direction.multiplyBy(ease / duration),
-			    speed = speedVector.distanceTo([0, 0]),
-
-			    limitedSpeed = Math.min(options.inertiaMaxSpeed, speed),
-			    limitedSpeedVector = speedVector.multiplyBy(limitedSpeed / speed),
-
-			    decelerationDuration = limitedSpeed / (options.inertiaDeceleration * ease),
-			    offset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round();
-
-			if (!offset.x || !offset.y) {
-				map.fire('moveend');
-			} else {
-				offset = map._limitOffset(offset, map.options.maxBounds);
-
-				L.Util.requestAnimFrame(function () {
-					map.panBy(offset, {
-						duration: decelerationDuration,
-						easeLinearity: ease,
-						noMoveStart: true,
-						animate: true
-					});
-				});
-			}
-		}
+		map.fire('moveend');
 	}
 });


More information about the Libreoffice-commits mailing list