Skip to main content

Translate

TranslateAction

Translate can be applied to single components or groups of components, used for moving componets from one position to another.


Constructor

public TranslateAction

new TranslateAction(objs, targetPositions, snap)

Creates a translation of component(s) from one position to another. Each component in objs list has corresponding initial position and target position in those respective lists.

Parameters

  •  objs: Component[] – Initializes the array with the selected component(s).

  •  targetPositions: Vector[] – Initializes the array with the selected components' final positions.

  •  snap: false | true – Sets whether or not components will snap. Defaults to true.


Properties

No publicly accessible properties on TranslateAction

protected objs: Component[]

An array of the selected component(s).

protected initialPositions: Vector[]

An array of the starting position(s) of the selected component(s).

protected targetPositions: Vector[]

An array of the final position(s) of the selected component(s).

protected snap: false | true

Flag that represents whether or not positions should be snapped. Necessary to resolve issue #910.


Methods

public execute

execute() => Action

Moves object from the initial to target position, and snaps the wires accordingly.

Returns

  •   Action – An Action where the translation is executed.

public undo

undo() => Action

Reverts a previous translation by moving component back to initial position.

Returns

  •   Action – An Action where the translation is undone.

public getName

getName() => string

Description needed

Returns

  •   stringDescription needed

public getCustomInfo

getCustomInfo() => string[]

Description needed

Returns

  •   string[]Description needed

Static Methods

No static methods for TranslateAction


Functions

Translate

Translate(objs, targetPositions, snap) => TranslateAction

Description needed

Parameters

  •  objs: Component[]Description needed

  •  targetPositions: Vector[]Description needed

  •  snap: false | trueDescription needed

Returns

  •   TranslateActionDescription needed