xushiting 2 年之前
父节点
当前提交
afa127968a
共有 1 个文件被更改,包括 35 次插入30 次删除
  1. 35 30
      src/graphic/Controls/UIControl.js

+ 35 - 30
src/graphic/Controls/UIControl.js

@@ -136,38 +136,43 @@ export default class UIControl {
   //   }
   // }
 
-  // //撤销
-  // menu_revoke() {
-  //   // this.layer.history.goPreState()
-  //   // this.layer.renderer.autoRedraw()
-
-  //   // const historyState = historyService.getHistoryState()
-  //   // if (historyState.pre) {
-  //   //     this.layer.$xui.toolbar.recall = true
-  //   // } else {
-  //   //     this.layer.$xui.toolbar.recall = false
-  //   // }
-  //   // this.layer.$xui.toolbar.recover = true
-  //   this.layer.stopAddVector();
-  //   this.layer.revokeHistory();
-  // }
+  //撤销
+  menu_revoke() {
+    this.layer.history.goPreState();
+    this.layer.renderer.autoRedraw();
+
+    const historyState = historyService.getHistoryState();
+    // if (historyState.pre) {
+    //     this.layer.$xui.toolbar.recall = true
+    // } else {
+    //     this.layer.$xui.toolbar.recall = false
+    // }
+
+    this.layer.stopAddVector();
+    this.layer.revokeHistory();
+  }
 
-  // //恢复
-  // menu_recovery() {
-  //   // this.layer.history.goNextState()
-  //   // this.layer.renderer.autoRedraw()
-
-  //   // const historyState = historyService.getHistoryState()
-  //   // if (historyState.next) {
-  //   //     this.layer.$xui.toolbar.recover = true
-  //   // } else {
-  //   //     this.layer.$xui.toolbar.recover = false
-  //   // }
-  //   // this.layer.$xui.toolbar.recall = true
-  //   this.layer.recoveryHistory();
-  // }
+  //恢复
+  menu_recovery() {
+    this.layer.history.goNextState();
+    this.layer.renderer.autoRedraw();
+
+    const historyState = historyService.getHistoryState();
+    // if (historyState.next) {
+    //   this.layer.$xui.toolbar.recover = true;
+    // } else {
+    //   this.layer.$xui.toolbar.recover = false;
+    // }
+    // this.layer.$xui.toolbar.recall = true;
+    this.layer.recoveryHistory();
+  }
 
-  // menu_default() {}
+  menu_clear() {
+    dataService.clear();
+    elementService.hideAll();
+    this.layer.history.save();
+    this.layer.renderer.autoRedraw();
+  }
 
   /******************************************************************************************************************************************************************/
 }