Example
import LayerSwitcher from "gpf-ext-ol/controls/LayerSwitcher"
ou
import { LayerSwitcher } from "gpf-ext-ol"
Events
-
layerswitcher:add
Controls/LayerSwitcher/LayerSwitcher.js, line 376 -
event triggered when a layer is added
Properties:
Name Type Description type Object event
layer Object layer
target Object instance LayerSwitcher
Example
LayerSwitcher.on("layerswitcher:add", function (e) { console.log(e.layer); })
-
layerswitcher:add
Controls/LayerSwitcher/LayerSwitcher.js, line 436 -
event triggered when a layer is removed
Properties:
Name Type Description type Object event
layer Object layer
target Object instance LayerSwitcher
Example
LayerSwitcher.on("layerswitcher:remove", function (e) { console.log(e.layer); })
-
layerswitcher:change:opacity
Controls/LayerSwitcher/LayerSwitcher.js, line 903 -
event triggered when an opacity layer is changed
Properties:
Name Type Description type Object event
opacity Object opacity
layer Object layer
target Object instance LayerSwitcher
Example
LayerSwitcher.on("layerswitcher:change", function (e) { console.log(e.opacity); })
-
layerswitcher:change:visibility
Controls/LayerSwitcher/LayerSwitcher.js, line 951 -
event triggered when an visibility layer is changed
Properties:
Name Type Description type Object event
visibility Object visibility
layer Object layer
target Object instance LayerSwitcher
Example
LayerSwitcher.on("layerswitcher:change:visibility", function (e) { console.log(e.visibility); })
-
layerswitcher:change:visibility
Controls/LayerSwitcher/LayerSwitcher.js, line 1180 -
event triggered when an position layer is changed
Properties:
Name Type Description type Object event
position Object position
layer Object layer
layers Object layers sorted
target Object instance LayerSwitcher
Example
LayerSwitcher.on("layerswitcher:change:position", function (e) { console.log(e.position); })
-
layerswitcher:zoom
Controls/LayerSwitcher/LayerSwitcher.js, line 1291 -
event triggered when an zoom extent is done
Properties:
Name Type Description type Object event
extent Object extent (map projection)
layer Object layer
error String error
target Object instance LayerSwitcher
Example
LayerSwitcher.on("layerswitcher:extent", function (e) { console.log(e.extent); })