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