new Toggle( [options])
A simple toggle control The control can be created with an interaction to control its activation.
Parameters:
Name | Type | Argument | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Control options. Properties
|
Fires:
- change:active,event: change:disable
Extends
Methods
-
getActive()
-
Test if the control is active.
Returns:
.
- Type
- bool
-
getDisable()
-
Test if the control is disabled.
Returns:
.
- Type
- bool
-
getInteraction()
-
Get the control interaction
Returns:
interaction associated with the control
- Type
- _ol_interaction_
-
getSubBar()
-
Get the subbar associated with a control
Returns:
- Type
- ol.control.Bar
-
setActive(b)
-
Change control state
Parameters:
Name Type Description b
bool activate or deactivate the control, default false
-
setDisable(b)
-
Disable the control. If disable, the control will be deactivated too.
Parameters:
Name Type Description b
bool disable (or enable) the control, default false (enable)
-
setInteraction(i)
-
Set the control interaction
Parameters:
Name Type Description i
_ol_interaction_ interaction to associate with the control
-
setMap(map)
-
Set the map instance the control is associated with and add interaction attached to it to this map.
Parameters:
Name Type Description map
_ol_Map_ The map instance.
-
toggle()
-
Toggle control state active/deactive