mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-08-16 16:45:22 +00:00
Update L.Polyline's _pxBounds when their stroke weight changes (#6516)
This commit is contained in:

committed by
Vladimir Agafonkin

parent
dc6a0ae61a
commit
13f649d4cd
@ -105,6 +105,9 @@ export var Path = Layer.extend({
|
||||
Util.setOptions(this, style);
|
||||
if (this._renderer) {
|
||||
this._renderer._updateStyle(this);
|
||||
if (this.options.stroke && style.hasOwnProperty('weight')) {
|
||||
this._updateBounds();
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
@ -203,14 +203,19 @@ export var Polyline = Path.extend({
|
||||
this._rings = [];
|
||||
this._projectLatlngs(this._latlngs, this._rings, pxBounds);
|
||||
|
||||
if (this._bounds.isValid() && pxBounds.isValid()) {
|
||||
this._rawPxBounds = pxBounds;
|
||||
this._updateBounds();
|
||||
}
|
||||
},
|
||||
|
||||
_updateBounds: function () {
|
||||
var w = this._clickTolerance(),
|
||||
p = new Point(w, w);
|
||||
|
||||
if (this._bounds.isValid() && pxBounds.isValid()) {
|
||||
pxBounds.min._subtract(p);
|
||||
pxBounds.max._add(p);
|
||||
this._pxBounds = pxBounds;
|
||||
}
|
||||
this._pxBounds = new Bounds([
|
||||
this._rawPxBounds.min.subtract(p),
|
||||
this._rawPxBounds.max.add(p)
|
||||
]);
|
||||
},
|
||||
|
||||
// recursively turns latlngs into a set of rings with projected coordinates
|
||||
|
Reference in New Issue
Block a user