Skip to main content

Class: CommandManager

Performs operations on the product and its design elements.

Example​

const ids = (await editor.getSelectedItems()).map(item => item.id);

const args = {
translateX: 108,
translateY: 0,
itemIds: ids
};

// Moves the selected items 1.5 inches horizontally.
editor.commandManager.execute("translateItems", args);

Implements​

Constructors​

Constructor​

new CommandManager(postMessageClient): CommandManager

Parameters​

postMessageClient​

Client

Returns​

CommandManager

Methods​

execute()​

execute(name, args?, historyUpdateMode?): Promise<any>

Executes the Translate and Resize operations.

Parameters​

name​

any

The name of the operation, for example, "translateItems" or "resize".

args?​

any

An object defining arguments of the operation. The current implementation supports IExternalResizeArgs and IExternalTranslateItemCommandArgs.

historyUpdateMode?​

HistoryUpdateMode

Defines how the history of user actions should be updated, one of NotUpdate, Update (by default), or ForceUpdate.

Returns​

Promise<any>

Example​

const ids = (await editor.getSelectedItems()).map(item => item.id);

const args = {
translateX: 108,
translateY: 0,
itemIds: ids
};

// Moves the selected items 1.5 inches horizontally.
editor.commandManager.execute("translateItems", args);
Was this page helpful?