-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
InteractiveLayerPatch.js
38 lines (34 loc) · 1.01 KB
/
InteractiveLayerPatch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Sets this layer to be interactive or not.
* @param interactive {boolean} If true, this layer will be interactive. Otherwise layer will be static.
* @author Piero "Jadaw1n" Steinger. Home page: https://github.com/Jadaw1n
* @instance
* @memberOf L.Layer
*/
L.Layer.prototype.setInteractive = function (interactive) {
if (this.eachLayer) {
this.eachLayer((layer) => layer.setInteractive(interactive));
return;
}
if (!this._path)
return;
this.options.interactive = interactive;
L.DomUtil[interactive ? "addClass" : "removeClass"](this._path, "leaflet-interactive");
};
/**
* @return {boolean} True, if this layer is interactive. False otherwise.
* @instance
* @memberOf L.Layer
*/
L.Layer.prototype.getInteractive = function () {
return this.options.interactive;
}
/**
* Alias for @{link L.Layer.getInteractive}
* @return {boolean} True, if this layer is interactive. False otherwise.
* @instance
* @memberOf L.Layer
*/
L.Layer.prototype.isInteractive = function () {
return this.getInteractive();
}