@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
24 lines • 1.13 kB
JavaScript
import { NotImplementedException } from "@aurigma/design-atoms-model/Exception";
import { BaseItemsCommand } from "./BaseItemsCommand";
import { Color } from "@aurigma/design-atoms-model/Colors";
import { ClipartItem } from "@aurigma/design-atoms-model/Product/Items/ClipartItem";
export class ChangeClipartItemColorCommand extends BaseItemsCommand {
constructor(historyArgs, args) {
super(null, historyArgs, args);
}
async _executeCommandBody() {
const { clipartItem, colorGroup, newColor } = this._args;
if (!(clipartItem instanceof ClipartItem) || colorGroup == null || newColor == null)
throw new Error("ChangeClipartItemColorCommand: Uncorrect arguments");
if (!(newColor instanceof Color || newColor.color instanceof Color))
throw new Error("ChangeClipartItemColorCommand: Uncorrect color");
clipartItem.setColor(colorGroup, newColor);
}
redo() {
throw new NotImplementedException();
}
undo() {
throw new NotImplementedException();
}
}
//# sourceMappingURL=ChangeClipartItemColor.js.map