loleaflet: don't scroll based on the selection, but based on the cursor

This commit is contained in:
Mihai Varga 2015-10-15 20:27:46 +03:00
parent c639e76ac2
commit b518046a59

View file

@ -417,16 +417,6 @@ L.TileLayer = L.GridLayer.extend({
selectionCenter = selectionCenter.add(topLeftTwips);
selectionCenter = selectionCenter.add(offset.divideBy(2));
}
// average of all rectangles' centers
selectionCenter = selectionCenter.divideBy(strTwips.length / 4);
selectionCenter = this._twipsToLatLng(selectionCenter);
if (!this._map.getBounds().contains(selectionCenter)) {
var center = this._map.project(selectionCenter);
center = center.subtract(this._map.getSize().divideBy(2));
center.x = Math.round(center.x < 0 ? 0 : center.x);
center.y = Math.round(center.y < 0 ? 0 : center.y);
this._map.fire('scrollto', {x: center.x, y: center.y});
}
var polygons = L.PolyUtil.rectanglesToPolygons(rectangles, this);
for (i = 0; i < polygons.length; i++) {