UNPKG

@aurigma/design-atoms

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

32 lines 1.53 kB
import { Matrix } from "@aurigma/design-atoms-model/Math"; import { BaseItemsCommand } from "../BaseItemsCommand"; import { HistoryUpdateMode } from "../../ModelUpdateCommand"; import { NotImplementedException, ArgumentException } from "@aurigma/design-atoms-model/Exception"; import { ItemsCommand } from "@aurigma/design-atoms-interfaces"; export class NewTranslateItemsCommand extends BaseItemsCommand { constructor(productHandler, historyArgs, args, _commandManager) { super(productHandler, historyArgs, args); this._commandManager = _commandManager; } async _executeCommandBody() { let { delta, finished } = this._args; const items = this._getTargetItems(this._args.items, this._args.query, this._args.queryOptions); if (delta == null || items == null) throw new ArgumentException("NewTranslateItemsCommand: delta and items cannot be null"); const matrix = new Matrix().translate(delta.x, delta.y); let itemsTransformArgs = { items: items, matrix: matrix, finished: finished }; const historyMode = finished ? HistoryUpdateMode.ForceUpdate : HistoryUpdateMode.NotUpdate; await this._commandManager.execute(ItemsCommand.transformItems, itemsTransformArgs, historyMode); } redo() { throw new NotImplementedException(); } undo() { throw new NotImplementedException(); } } //# sourceMappingURL=NewTranslateItemsCommand.js.map