Use Polyline.getCenter instead of bounds to center hover on map (#241)

Returns point on line at half distance instead of centroid of bounds,
which can be far off the line for curved lines and not show line at high
zooms.
This commit is contained in:
Norbert Renner 2019-11-30 12:27:26 +01:00
parent b57c4f2bf6
commit 0781bb85dc

View file

@ -208,7 +208,7 @@ BR.TrackMessages = L.Class.extend({
this._hoveredEdge = this._getRowEdge(tr).addTo(this._map); this._hoveredEdge = this._getRowEdge(tr).addTo(this._map);
if (this.options.syncMap && !this._selectedEdge) { if (this.options.syncMap && !this._selectedEdge) {
this._map.panTo(this._hoveredEdge.getBounds().getCenter()); this._map.panTo(this._hoveredEdge.getCenter());
} }
}, },