mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-07-20 16:37:08 +00:00
Only call add/removeInteractiveTarget for path if actually interactive
This commit is contained in:
@ -95,12 +95,16 @@ export const SVG = Renderer.extend({
|
||||
_addPath(layer) {
|
||||
if (!this._rootGroup) { this._initContainer(); }
|
||||
this._rootGroup.appendChild(layer._path);
|
||||
layer.addInteractiveTarget(layer._path);
|
||||
if (layer.options.interactive) {
|
||||
layer.addInteractiveTarget(layer._path);
|
||||
}
|
||||
},
|
||||
|
||||
_removePath(layer) {
|
||||
layer._path.remove();
|
||||
layer.removeInteractiveTarget(layer._path);
|
||||
if (layer.options.interactive) {
|
||||
layer.removeInteractiveTarget(layer._path);
|
||||
}
|
||||
delete this._layers[stamp(layer)];
|
||||
},
|
||||
|
||||
@ -147,8 +151,10 @@ export const SVG = Renderer.extend({
|
||||
|
||||
if (options.interactive) {
|
||||
path.classList.add('leaflet-interactive');
|
||||
layer.addInteractiveTarget(path);
|
||||
} else {
|
||||
path.classList.remove('leaflet-interactive');
|
||||
layer.removeInteractiveTarget(path);
|
||||
}
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user