@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
34 lines • 1.74 kB
JavaScript
import { PlaceholderItem } from "@aurigma/design-atoms-model/Product/Items";
import { NotImplementedException } from "@aurigma/design-atoms-model/Exception";
import { HistoryUpdateMode } from "../ModelUpdateCommand";
import { BaseItemsCommand } from "./BaseItemsCommand";
import { EqualsOfFloatNumbers } from "@aurigma/design-atoms-model";
export class PlaceholderContentScaleCommand extends BaseItemsCommand {
constructor(productHandler, args, historyArgs) {
super(productHandler, historyArgs, args);
}
async _executeCommandBody() {
var _a;
const items = (_a = this._getTargetItems(this._args.items, this._args.query, this._args.queryOptions)) !== null && _a !== void 0 ? _a : this._productHandler.selectedItems;
const value = this._args.scale;
items.forEach(i => {
if (!(i instanceof PlaceholderItem))
return;
const placeholderItemHandler = this._productHandler.getHandler(i);
placeholderItemHandler.forceQualityChangeInfoBar = this._args.forceQualityChangeInfoBar != null ? this._args.forceQualityChangeInfoBar : false;
if (!EqualsOfFloatNumbers(placeholderItemHandler.getContentScale(), value))
placeholderItemHandler.setContentScale(value);
if (this._historyArgs.historyUpdateMode !== HistoryUpdateMode.NotUpdate)
placeholderItemHandler.quickUpdate();
});
this._productHandler.updateSelection();
this._productHandler.redraw();
}
redo() {
throw new NotImplementedException();
}
undo() {
throw new NotImplementedException();
}
}
//# sourceMappingURL=PlaceholderContentScaleCommand.js.map