---
metadata:
  - name: generator
    content: Diplodoc Platform v5.39.1
alternate:
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.behavior.Manager.md
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/ru/v2-1/ref/reference/map.behavior.Manager.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com.tr/dev/jsapi-v2-1/doc/en/llms.txt

# map.behavior.Manager

Extends [ICustomizable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md), [IEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md), [IParentOnMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IParentOnMap.md).

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](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md#behaviors)

[Constructor](#constructor-summary) | [Fields](#properties-summary) | [Events](#events-summary) | [Methods](#methods-summary)

## Constructor {#constructor-summary}

```javascript
map.behavior.Manager(map[, behaviors[, options]])
```

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`map`](#param-map)[*](*star) | — | Type: [Map](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md)

Map. ||
|| [`behaviors`](#param-behaviors) | — | 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: 
- "default" - Shortcut for enabling/disabling default map behaviors.
- "drag" - Dragging the map when the left mouse button is held down, or by a single touch [behavior.Drag](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.Drag.md).
- "scrollZoom" - Changing the zoom with the mouse wheel [behavior.ScrollZoom](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.ScrollZoom.md).
- "dblClickZoom" - Zooming the map on a double click [behavior.DblClickZoom](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.DblClickZoom.md).
- "multiTouch" - Zooming the map with a multi touch (i.e. on a touch screen) [behavior.MultiTouch](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.MultiTouch.md).
- "rightMouseButtonMagnifier" - Magnifying the area that is selected using the right mouse button (for desktop browsers only), [behavior.RightMouseButtonMagnifier](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.RightMouseButtonMagnifier.md).
- "leftMouseButtonMagnifier" - Magnifying the area selected by the left mouse button or a single touch, [behavior.LeftMouseButtonMagnifier](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.LeftMouseButtonMagnifier.md).
- "ruler" - Measuring distance [behavior.Ruler](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.Ruler.md).
- "routeEditor" - Route editor [behavior.RouteEditor](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.RouteEditor.md).

You can add and remove behavior classes via the behaviors storage [behavior.storage](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.storage.md). ||
|| [`options`](#param-options) | — | Type: Object

Behavior options. The following options can be set: 
- Options for the [behavior.Drag](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.Drag.md#constructor-summary) behavior with the `drag` prefix.
- Options for the [behavior.ScrollZoom](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.ScrollZoom.md#constructor-summary) behavior with the `scrollZoom` prefix.
- Options for the [behavior.DblClickZoom](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.DblClickZoom.md#constructor-summary) behavior with the `dblClickZoom` prefix.
- Options for the [behavior.MultiTouch](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.MultiTouch.md#constructor-summary) behavior with the `multiTouch` prefix.
- Options for the [magnifier.RightMouseButtonMagnifier](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.RightMouseButtonMagnifier.md#constructor-summary) behavior with the `rightMouseButtonMagnifier` prefix.
- Options for the [behavior.LeftMouseButtonMagnifier](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.LeftMouseButtonMagnifier.md#constructor-summary) behavior with the `leftMouseButtonMagnifier` prefix.
- Options for the [behavior.Ruler](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/behavior.Ruler.md#constructor-summary) behavior with the `ruler` prefix. ||
|#

\* Mandatory parameter/option.

## Fields {#properties-summary}

#|
|| **Name** | **Type** | **Description** ||
|| [events](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md#events) | [IEventManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventManager.md) | Event manager.

Inherited from [IEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md#events). ||
|| [options](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#options) | [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md) | Options manager.

Inherited from [ICustomizable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#options). ||
|#

## Events {#events-summary}

#|
|| **Name** | **Description** ||
|| [mapchange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IParentOnMap.md#event-mapchange) | Map reference changed. Data fields: 
- oldMap - Old map.
- newMap - New map.

Inherited from [IParentOnMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IParentOnMap.md#event-mapchange). ||
|| [optionschange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#event-optionschange) | Change to the object options.

Inherited from [ICustomizable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#event-optionschange). ||
|#

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [disable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.behavior.Manager.md#disable)([behaviors](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.behavior.Manager.md#disable-param-behaviors)) | [map.behavior.Manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.behavior.Manager.md) | Disables behaviors on the map. ||
|| [enable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.behavior.Manager.md#enable)([behaviors](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.behavior.Manager.md#enable-param-behaviors)) | [map.behavior.Manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.behavior.Manager.md) | Enables behaviors on the map. ||
|| [get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.behavior.Manager.md#get)([behaviorName](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.behavior.Manager.md#get-param-behaviorName)) | [IBehavior](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBehavior.md) | Returns instance of the behavior by the key. ||
|| [getMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IParentOnMap.md#getMap)() | [Map](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md) | Returns reference to the map.

Inherited from [IParentOnMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IParentOnMap.md#getMap). ||
|| [isEnabled](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.behavior.Manager.md#isEnabled)([behaviorName](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.behavior.Manager.md#isEnabled-param-behaviorName)) | Boolean | Checks whether a behavior is currently enabled.||
|#

## Methods details {#method_detail}

### disable {#disable}

```javascript
{map.behavior.Manager} disable(behaviors)
```

Disables behaviors on the map.

**Returns** self-reference.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`behaviors`](#disable-param-behaviors)[*](*star) | — | Type: String\|String[]

List of behaviors that can be disabled. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
myMap.behaviors.disable('drag');
```

### enable {#enable}

```javascript
{map.behavior.Manager} enable(behaviors)
```

Enables behaviors on the map.

**Returns** self-reference.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`behaviors`](#enable-param-behaviors)[*](*star) | — | Type: String\|String[]

List of behaviors that can be enabled. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
myMap.behaviors.enable(['ruler', 'multiTouch']);
```

### get {#get}

```javascript
{IBehavior} get(behaviorName)
```

**Returns** instance of the behavior by the key.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`behaviorName`](#get-param-behaviorName)[*](*star) | — | Type: String

Name of the behavior. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
myMap.behaviors.get('drag');
```

### isEnabled {#isEnabled}

```javascript
{Boolean} isEnabled(behaviorName)
```

Checks whether a behavior is currently enabled.

**Returns** true if the behavior is enabled, otherwise false.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`behaviorName`](#isEnabled-param-behaviorName)[*](*star) | — | Type: String

Behavior ID. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
// If the "drag" behavior is disabled, we enable it
if (!(myMap.behaviors.isEnabled('drag'))) {
    myMap.behaviors.enable('drag');
}
```

[*star]: Mandatory parameter/option.