aico-image-editor
Version:
Combine multiple image into and create single combined image
21 lines • 523 B
JavaScript
/**
* AddCommand for undoing adding of object
*
*/
export class AddCommand {
constructor(object, canvas) {
this.object = object;
this.canvas = canvas;
}
execute() {
this.object.removedViaHistory = false;
this.object.addedViaHistory = true;
this.object.commandName = this.constructor.name;
this.canvas.add(this.object);
}
undo() {
this.object.removedViaHistory = true;
this.object.addedViaHistory = false;
this.canvas.remove(this.object);
}
}