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

# map.action.Manager

Extends [IEventEmitter](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md).

Map actions manager. Makes complex movements possible on the map and ensures that complex movements do not overlap each other. Every map already has its own actions manager, available as [Map.action](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md#action). Don't create new instances of this class unless necessary.

**See** [Map.action](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md#action)

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

## Constructor {#constructor-summary}

```javascript
map.action.Manager(map)
```

**Parameters:**

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

Map. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
// Creating a complex movement: every 100 ms, the map
// center shifts a random amount.

// Creating an instance of the complex movement
var action = new ymaps.map.action.Continuous();
// Executing it on the map
myMap.action.execute(action);

// Recalling the pixel map center and zoom level
var center = myMap.getGlobalPixelCenter();
var zoom = myMap.getZoom();
// Generate a random shift every 100 milliseconds
var interval = window.setInterval(function () {
    center[0] += Math.round(Math.random() * 100) - 50;
    center[1] += Math.round(Math.random() * 100) - 50;
    // Generating a new shift in the map
    action.tick({
        globalPixelCenter: center,
       zoom: zoom
    });
}, 100);

// As soon as the user moves the map, our movement
// stops being executed and the "end" event occurs.
var listener = action.events.once('end', function () {
    listener.removeAll();
    window.clearInterval(interval);
});
```

## Fields {#properties-summary}

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

Inherited from [IEventEmitter](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md#events). ||
|#

## Events {#events-summary}

#|
|| **Name** | **Description** ||
|| [begin](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#event-begin) | Event that occurs when an action has started. Instance of the [Event](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- action - Action that has started. ||
|| [break](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#event-break) | Event that occurs when an action step was prematurely stopped (for example, because another action or another step of the action was performed). Instance of the [Event](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- action - An action. ||
|| [end](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#event-end) | Event that occurs when an action is stopped. Instance of the [Event](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- action - Action that has stopped. ||
|| [tick](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#event-tick) | Event that occurs when the next step of an action begins to be performed. Instance of the [Event](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- action - The action being performed at this moment.
- tick - Description of an action step in the form of an object with the fields "globalPixelCenter", "zoom", "duration" and "timingFunction". ||
|| [tickcomplete](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#event-tickcomplete) | Event that occurs when an action step has been completed. Instance of the [Event](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- action - The action being performed at this moment.
- tick - Description of an action step in the form of an object with the fields "globalPixelCenter", "zoom", "duration" and "timingFunction". ||
|#

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [breakTick](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#breakTick)() | | Interrupts an action step. ||
|| [execute](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#execute)([action](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#execute-param-action)) | | Starts an action on the map. If a different movement is being performed on the map at this time, it is stopped (the "end" method is called). The new movement is started using a "begin" method call. ||
|| [getCurrentState](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#getCurrentState)() | Object | Checks the map state at the time of smooth movement. ||
|| [getMap](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#getMap)() | [Map](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md) | Returns reference to the map. ||
|| [setCorrection](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#setCorrection)([userFunction](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#setCorrection-param-userFunction)) | | Used for making user adjustments to complex movements on the map. When the adjustment is finished, the corrected values must be returned. ||
|| [stop](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.action.Manager.md#stop)() | | Stops an action being performed on the map. ||
|#

## Events details {#event_detail}

### begin {#begin}

Event that occurs when an action has started. Instance of the [Event](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- action - Action that has started.

### break {#break}

Event that occurs when an action step was prematurely stopped (for example, because another action or another step of the action was performed). Instance of the [Event](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- action - An action.

### end {#end}

Event that occurs when an action is stopped. Instance of the [Event](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- action - Action that has stopped.

### tick {#tick}

Event that occurs when the next step of an action begins to be performed. Instance of the [Event](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- action - The action being performed at this moment.
- tick - Description of an action step in the form of an object with the fields "globalPixelCenter", "zoom", "duration" and "timingFunction".

**Example:**

```javascript
// Tracks all map movement, even user dragging
// and smooth zooming
myMap.action.events.add('tick', function (e) {
    var tick = e.get('tick');
    console.log('Now the map is moving to the point (' +

myMap.options.get('projection').fromGlobalPixels(tick.globalPixelCenter, tick.zoom).join(',') +
        ') during ' + e.get('tick').duration + ' milliseconds');
});
```

### tickcomplete {#tickcomplete}

Event that occurs when an action step has been completed. Instance of the [Event](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- action - The action being performed at this moment.
- tick - Description of an action step in the form of an object with the fields "globalPixelCenter", "zoom", "duration" and "timingFunction".

## Methods details {#method_detail}

### breakTick {#breakTick}

```javascript
{} breakTick()
```

Interrupts an action step.

### execute {#execute}

```javascript
{} execute(action)
```

Starts an action on the map. If a different movement is being performed on the map at this time, it is stopped (the "end" method is called). The new movement is started using a "begin" method call.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`action`](#execute-param-action)[*](*star) | — | Type: [IMapAction](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IMapAction.md)

Action. ||
|#

\* Mandatory parameter/option.

### getCurrentState {#getCurrentState}

```javascript
{Object} getCurrentState()
```

Checks the map state at the time of smooth movement.

**Returns** object with the fields: isTicking - Whether a step of smooth movement is being performed. tickProgress - Which part of the current step has been completed. zoom - The map zoom during the current step. globalPixelCenter - The map center in global pixels during the current step.

**Example:**

```javascript
// Logs the current map center.
// Even works during smooth zooming or
// while the user is dragging the map.
window.setInterval(function () {
    console.log(myMap.action.getCurrentState().center.join(', '));
}, 100);
```

### getMap {#getMap}

```javascript
{Map} getMap()
```

**Returns** reference to the map.

### setCorrection {#setCorrection}

```javascript
{} setCorrection(userFunction)
```

Used for making user adjustments to complex movements on the map. When the adjustment is finished, the corrected values must be returned.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`userFunction`](#setCorrection-param-userFunction)[*](*star) | — | Type: Function

Custom function for adjusting steps. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
// Making it impossible for the user to drag the map center
// outside of the Moscow Ring Road.
var mkad = [
    [55.785017, 37.841576],
    [55.861979, 37.765992],
    [55.898533, 37.635961],
    [55.888897, 37.48861],
    [55.83251, 37.395275],
    [55.744789, 37.370248],
    [55.660424, 37.434424],
    [55.5922, 37.526366],
    [55.574019, 37.683167],
    [55.62913, 37.802473],
    [55.712203, 37.837121]
];
var mkadPolygon = new ymaps.Polygon([mkad], {}, {
    fillColor: '#FFFF00',
    opacity: .4
});
myMap.geoObjects.add(mkadPolygon);
myMap.action.setCorrection(function (tick) {
    var projection = myMap.options.get('projection');
    var tickCenter = projection.fromGlobalPixels(tick.globalPixelCenter, tick.zoom);
    // If the map center is not in our area.
    if (!mkadPolygon.geometry.contains(tickCenter)) {
        tick.globalPixelCenter = projection.toGlobalPixels(
            mkadPolygon.geometry.getClosest(tickCenter).position,
            tick.zoom
        );
        tick.duration = 0;
    }
    return tick;
});
```

### stop {#stop}

```javascript
{} stop()
```

Stops an action being performed on the map.

[*star]: Mandatory parameter/option.