|
@@ -1,5 +1,6 @@
|
|
|
import { SObject } from "../SObject";
|
|
|
import { SUndoCommand } from "./SUndoCommand";
|
|
|
+import { SCommandLog } from "./SCommandLog";
|
|
|
|
|
|
/**
|
|
|
* Undo操作堆栈
|
|
@@ -90,7 +91,7 @@ export class SUndoStack extends SObject {
|
|
|
*/
|
|
|
count(): number {
|
|
|
return this.cmdStack.length;
|
|
|
- } // Function cout()
|
|
|
+ } // Function count()
|
|
|
|
|
|
/**
|
|
|
* 将命令添加到命令栈
|
|
@@ -106,4 +107,20 @@ export class SUndoStack extends SObject {
|
|
|
this.cmdStack.push(cmd);
|
|
|
this._index = this.cmdStack.length - 1;
|
|
|
} // Function push()
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将命令堆栈转为日志(命令数组)
|
|
|
+ *
|
|
|
+ * */
|
|
|
+ toLog(): SCommandLog[] {
|
|
|
+ let stackList: SCommandLog[] = [];
|
|
|
+ for (let i = 0; i <= this.index; i++) {
|
|
|
+ stackList.push({
|
|
|
+ command: this.cmdStack[i].command,
|
|
|
+ desc: this.cmdStack[i].desc,
|
|
|
+ detail: this.cmdStack[i].toString()
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return stackList;
|
|
|
+ } // Function toLog()
|
|
|
} // Class SUndoStack
|