12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import { SGraphCommand } from "@saga-web/graph/lib/commands/SGraphCommand";
- import { SGraphItem } from "@saga-web/graph/lib/SGraphItem";
- import { SGraphScene } from "@saga-web/graph/lib/SGraphScene";
- import { SUndoCommand } from "@saga-web/base/lib";
- export class SGraphDeleteCommand extends SGraphCommand {
-
- item: SGraphItem;
-
- parent: SGraphItem | null;
-
- constructor(scene: SGraphScene, item: SGraphItem) {
- super(scene);
- this.item = item;
- this.parent = item.parent;
- }
-
- mergeWith(command: SUndoCommand): boolean {
- return false;
- }
-
- undo(): void {
- this.item.parent = this.parent;
-
- this.parent.update();
- }
-
- redo(): void {
- this.item.parent = null;
-
- this.parent.update();
- }
- }
|