switch SVG paths to new delegation API
This commit is contained in:
parent
b149f2d754
commit
8e7bbff6d8
@ -74,10 +74,6 @@ L.Path = L.Layer.extend({
|
||||
return this;
|
||||
},
|
||||
|
||||
_fireMouseEvent: function (e, type) {
|
||||
this._map._fireMouseEvent(this, e, type, true);
|
||||
},
|
||||
|
||||
_clickTolerance: function () {
|
||||
// used when doing hit detection for Canvas layers
|
||||
return (this.options.stroke ? this.options.weight / 2 : 0) + (L.Browser.touch ? 10 : 0);
|
||||
|
@ -7,9 +7,6 @@ L.SVG = L.Renderer.extend({
|
||||
_initContainer: function () {
|
||||
this._container = L.SVG.create('svg');
|
||||
|
||||
this._paths = {};
|
||||
this._initEvents();
|
||||
|
||||
// makes it possible to click through svg root; we'll reset it back in individual paths
|
||||
this._container.setAttribute('pointer-events', 'none');
|
||||
},
|
||||
@ -54,15 +51,13 @@ L.SVG = L.Renderer.extend({
|
||||
},
|
||||
|
||||
_addPath: function (layer) {
|
||||
var path = layer._path;
|
||||
this._container.appendChild(path);
|
||||
this._paths[L.stamp(path)] = layer;
|
||||
this._container.appendChild(layer._path);
|
||||
layer.addInteractiveTarget(layer._path);
|
||||
},
|
||||
|
||||
_removePath: function (layer) {
|
||||
var path = layer._path;
|
||||
L.DomUtil.remove(path);
|
||||
delete this._paths[L.stamp(path)];
|
||||
L.DomUtil.remove(layer._path);
|
||||
layer.removeInteractiveTarget(layer._path);
|
||||
},
|
||||
|
||||
_updatePath: function (layer) {
|
||||
@ -139,19 +134,6 @@ L.SVG = L.Renderer.extend({
|
||||
|
||||
_bringToBack: function (layer) {
|
||||
L.DomUtil.toBack(layer._path);
|
||||
},
|
||||
|
||||
// TODO remove duplication with L.Map
|
||||
_initEvents: function () {
|
||||
L.DomEvent.on(this._container, 'click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu',
|
||||
this._fireMouseEvent, this);
|
||||
},
|
||||
|
||||
_fireMouseEvent: function (e) {
|
||||
var path = this._paths[L.stamp(e.target || e.srcElement)];
|
||||
if (path) {
|
||||
path._fireMouseEvent(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user