SGraphAddCommand.js 708 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.SGraphAddCommand = void 0;
  4. const SGraphCommand_1 = require("./SGraphCommand");
  5. class SGraphAddCommand extends SGraphCommand_1.SGraphCommand {
  6. constructor(scene, item) {
  7. super(scene);
  8. this.item = item;
  9. this.parent = item.parent;
  10. this.command = "SGraphAddCommand";
  11. this.desc = `添加对象=${item.id}`;
  12. }
  13. mergeWith(command) {
  14. return false;
  15. }
  16. redo() {
  17. this.item.parent = this.parent;
  18. this.parent.update();
  19. }
  20. undo() {
  21. this.item.parent = null;
  22. this.parent.update();
  23. }
  24. }
  25. exports.SGraphAddCommand = SGraphAddCommand;