Pārlūkot izejas kodu

'命令添加记录是否改变字段'

zhangyu 4 gadi atpakaļ
vecāks
revīzija
0d96af7dc7
1 mainītis faili ar 7 papildinājumiem un 0 dzēšanām
  1. 7 0
      saga-web-base/src/undo/SUndoStack.ts

+ 7 - 0
saga-web-base/src/undo/SUndoStack.ts

@@ -22,6 +22,9 @@ export class SUndoStack extends SObject {
         return this.cmdStack.length <= 0;
     } // Get isEmpty
 
+    /** 是否更改 */
+    isChange: boolean = false;
+
     /**
      * 执行redo操作
      */
@@ -32,6 +35,7 @@ export class SUndoStack extends SObject {
 
         this._index++;
         this.cmdStack[this._index].redo();
+        this.isChange = true;
     } // Function redo()
 
     /**
@@ -44,6 +48,7 @@ export class SUndoStack extends SObject {
 
         this.cmdStack[this._index].undo();
         this._index--;
+        this.isChange = true;
     } // Function undo()
 
     /**
@@ -70,6 +75,7 @@ export class SUndoStack extends SObject {
     clear(): void {
         this.cmdStack.length = 0;
         this._index = -1;
+        this.isChange = true;
     } // Function clear()
 
     /**
@@ -106,6 +112,7 @@ export class SUndoStack extends SObject {
 
         this.cmdStack.push(cmd);
         this._index = this.cmdStack.length - 1;
+        this.isChange = true;
     } // Function push()
 
     /**