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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 2 01:23:47 UTC 2018


 loleaflet/src/map/Map.js |   20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

New commits:
commit e4a7e2ddbb95103781ede9f777c1f814c408b844
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Wed Aug 1 21:20:12 2018 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Wed Aug 1 21:23:17 2018 -0400

    loleaflet: mobile: fix panning inside max bounds
    
    Change-Id: I5c08a529cb05471f3e248ab403dff5370de0ee46

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index f18ae861a..547915181 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -12,6 +12,7 @@ L.Map = L.Evented.extend({
 		zoom: 10,
 		minZoom: 1,
 		maxZoom: 20,
+		maxBounds: L.latLngBounds([0, 0], [-100, 100]),
 		fadeAnimation: false, // Not useful for typing.
 		trackResize: true,
 		markerZoomAnimation: true,
@@ -326,25 +327,14 @@ L.Map = L.Evented.extend({
 		return this.fire('moveend');
 	},
 
-	setMaxBounds: function (bounds, options) {
+	setMaxBounds: function (bounds) {
 		bounds = L.latLngBounds(bounds);
 
 		this.options.maxBounds = bounds;
-		options = options || {};
-
-		if (!bounds) {
-			return this.off('moveend', this._panInsideMaxBounds);
-		}
 
 		if (this._loaded) {
-			this._panInsideMaxBounds();
-		}
-
-		if (options.panInside === false) {
-			return this.off('moveend', this._panInsideMaxBounds);
+			this.panInsideBounds(this.options.maxBounds);
 		}
-
-		return this.on('moveend', this._panInsideMaxBounds);
 	},
 
 	setDocBounds: function (bounds) {
@@ -807,10 +797,6 @@ L.Map = L.Evented.extend({
 		return this.getMaxZoom() - this.getMinZoom();
 	},
 
-	_panInsideMaxBounds: function () {
-		this.panInsideBounds(this.options.maxBounds);
-	},
-
 	_checkIfLoaded: function () {
 		if (!this._loaded) {
 			throw new Error('Set map center and zoom first.');


More information about the Libreoffice-commits mailing list