map.behavior.Manager
Extends ICustomizable, IEventEmitter, IParentOnMap.
Map behaviors manager. Allows to enable and disable behaviors. Each map already has its own behavior manager, available as map.behaviors. Don't instantiate new instances of this class unless necessary
See Map.behaviors
Constructor | Fields | Events | Methods
Constructor
map.behavior.Manager(map[, behaviors[, options]])
Parameters:
Parameter |
Default value |
Description |
|
— |
Type: Map Map. |
— |
Type: String|String[] List of map behaviors that are immediately enabled when a map is created. By default - "drag", "dblClickZoom" and "rightMouseButtonMagnifier" for desktop browsers; "drag", "dblClickZoom" and "multiTouch" for mobile browsers. Acceptable key values:
You can add and remove behavior classes via the behaviors storage behavior.storage. |
|
— |
Type: Object Behavior options. The following options can be set:
|
* Mandatory parameter/option.
Fields
Name |
Type |
Description |
Event manager. Inherited from IEventEmitter. |
||
Options manager. Inherited from ICustomizable. |
Events
Name |
Description |
Map reference changed. Data fields:
Inherited from IParentOnMap. |
|
Change to the object options. Inherited from ICustomizable. |
Methods
Name |
Returns |
Description |
Disables behaviors on the map. |
||
Enables behaviors on the map. |
||
Returns instance of the behavior by the key. |
||
getMap() |
Returns reference to the map. Inherited from IParentOnMap. |
|
Boolean |
Checks whether a behavior is currently enabled. |
Methods details
disable
{map.behavior.Manager} disable(behaviors)
Disables behaviors on the map.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
— |
Type: String|String[] List of behaviors that can be disabled. |
* Mandatory parameter/option.
Example:
myMap.behaviors.disable('drag');
enable
{map.behavior.Manager} enable(behaviors)
Enables behaviors on the map.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
— |
Type: String|String[] List of behaviors that can be enabled. |
* Mandatory parameter/option.
Example:
myMap.behaviors.enable(['ruler', 'multiTouch']);
get
{IBehavior} get(behaviorName)
Returns instance of the behavior by the key.
Parameters:
Parameter |
Default value |
Description |
— |
Type: String Name of the behavior. |
* Mandatory parameter/option.
Example:
myMap.behaviors.get('drag');
isEnabled
{Boolean} isEnabled(behaviorName)
Checks whether a behavior is currently enabled.
Returns true if the behavior is enabled, otherwise false.
Parameters:
Parameter |
Default value |
Description |
— |
Type: String Behavior ID. |
* Mandatory parameter/option.
Example:
// If the "drag" behavior is disabled, we enable it
if (!(myMap.behaviors.isEnabled('drag'))) {
myMap.behaviors.enable('drag');
}
Mandatory parameter/option.