loleaflet: mobile: limit the center point with max bounds when zooming

Change-Id: Ic2a3823204a717cb17057f5d8b4e25efea2c7759
Reviewed-on: https://gerrit.libreoffice.org/77847
Reviewed-by: Henry Castro <hcastro@collabora.com>
Tested-by: Henry Castro <hcastro@collabora.com>
This commit is contained in:
Henry Castro 2019-07-13 15:38:59 -04:00
parent 93992872e1
commit 2ba4becb75

View file

@ -341,8 +341,9 @@ L.Map.TouchGesture = L.Handler.extend({
// we need to invert the offset or the map is moved in the opposite direction
var offset = {x: e.center.x - this._pinchStartCenter.x, y: e.center.y - this._pinchStartCenter.y};
var center = {x: this._pinchStartCenter.x - offset.x, y: this._pinchStartCenter.y - offset.y};
this._center = this._map.mouseEventToLatLng({clientX: center.x, clientY: center.y});
this._zoom = this._map.getScaleZoom(e.scale);
this._center = this._map._limitCenter(this._map.mouseEventToLatLng({clientX: center.x, clientY: center.y}),
this._zoom, this._map.options.maxBounds);
L.Util.cancelAnimFrame(this._animRequest);
this._animRequest = L.Util.requestAnimFrame(function () {