map.action.Single

Extends IMapAction.

Simple map movement. The movement is made immediately after it is passed to map.action.Manager.

Constructor | Fields | Events | Methods

Constructor

map.action.Single(tick)

Creates a simple (single step) map movement.

Parameters:

Parameter

Default value

Description

tick*

Type: Object

Movement parameters.

tick.callback

Type: Function

Function that will be called after performing the action. Accepts an error or null as a parameter, if the action was not successful.

tick.center

Type: Number[]

The new map center in geo coordinates.

tick.checkZoomRange

false

Type: Boolean

Flag showing whether the new map zoom needs to be checked. If the flag is set to true, the range of allowable zoom levels at the new point will be requested before performing the action. If the specified zoom does not fall within the allowable values, it will be corrected. In addition, the value of the new map center in global pixel coordinates will be changed.

tick.duration

0

Type: Number

Duration of making the move, in milliseconds.

tick.globalPixelCenter

Type: Number[]

The new map center in global pixels. When the "center" and "globalPixelCenter" parameters are set simultaneously, the "center" parameter is ignored.

tick.timingFunction

'linear'

Type: String

Timing function.

tick.zoom

Type: Number

The new map zoom.

* Mandatory parameter/option.

Example:

var myCallback = function(err) {
        if (err) {
            throw err;
        }
    },
    myAction = new ymaps.map.action.Single({
          center: [0, 0],
          zoom: 4,
          duration: 1000,
          timingFunction: 'ease-in',
          checkZoomRange: true,
          callback: myCallback
    });

// The action is performed immediately after calling "execute".
myMap.action.execute(myAction);

Fields

Name

Type

Description

events

IEventManager

Event manager.

Inherited from IEventEmitter.

Events

Name

Description

end

Event that notifies the map that movement has finished.

Inherited from IMapAction.

tick

Event that notifies the map of the next step. Contains the fields:

  • globalPixelCenter - The new map center, in global pixels.
  • zoom - The new map zoom.
  • duration - The time that is allowed for performing the step.
  • timingFunction - Function describing the type of movement.

Inherited from IMapAction.

Methods

Name

Returns

Description

begin(mapActionManager)

Starts the movement to be performed by the map. This method is called automatically by the map movement manager. From the moment when IMapAction.begin is called, the movement manager listens for IMapAction.event:tick and IMapAction.event:end and executes them.

Inherited from IMapAction.

end()

Stops movement.

Inherited from IMapAction.

isActive()

Boolean

Checks whether map movement is being performed at this moment.

Methods details

isActive

{Boolean} isActive()

Checks whether map movement is being performed at this moment.

Returns true if the movement is currently being performed by the map, otherwise false.