loleaflet: add _reset function to Path object

Used by L.Path.Transformation

Change-Id: I337bc583acb8ba1cf211e709b3bf3b9e7507d486
This commit is contained in:
Henry Castro 2018-10-30 10:50:26 -04:00 committed by Jan Holesovsky
parent 8a645d283a
commit 22eca5a299

View file

@ -27,11 +27,7 @@ L.Path = L.Layer.extend({
onAdd: function () { onAdd: function () {
this._renderer = this._map.getRenderer(this); this._renderer = this._map.getRenderer(this);
this._renderer._initPath(this); this._renderer._initPath(this);
this._reset();
// defined in children classes
this._project();
this._update();
this._renderer._addPath(this); this._renderer._addPath(this);
}, },
@ -75,6 +71,12 @@ L.Path = L.Layer.extend({
return this; return this;
}, },
_reset: function () {
// defined in child classes
this._project();
this._update();
},
_clickTolerance: function () { _clickTolerance: function () {
// used when doing hit detection for Canvas layers // used when doing hit detection for Canvas layers
return (this.options.stroke ? this.options.weight / 2 : 0) + (L.Browser.touch ? 10 : 0); return (this.options.stroke ? this.options.weight / 2 : 0) + (L.Browser.touch ? 10 : 0);