|
@@ -44,7 +44,6 @@ export class SUndoStack extends SObject {
|
|
}
|
|
}
|
|
set index(v: number) {
|
|
set index(v: number) {
|
|
this._index = v;
|
|
this._index = v;
|
|
- this.$emit("cmdListChange");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/** 命令栈是否为空 */
|
|
/** 命令栈是否为空 */
|
|
@@ -64,8 +63,9 @@ export class SUndoStack extends SObject {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- this._index++;
|
|
|
|
- this.cmdStack[this._index].redo();
|
|
|
|
|
|
+ this.index++;
|
|
|
|
+ this.cmdStack[this.index].redo();
|
|
|
|
+ this.$emit("cmdListChange");
|
|
this.isChange = true;
|
|
this.isChange = true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -78,8 +78,9 @@ export class SUndoStack extends SObject {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- this.cmdStack[this._index].undo();
|
|
|
|
- this._index--;
|
|
|
|
|
|
+ this.cmdStack[this.index].undo();
|
|
|
|
+ this.index--;
|
|
|
|
+ this.$emit("cmdListChange");
|
|
this.isChange = true;
|
|
this.isChange = true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -106,7 +107,7 @@ export class SUndoStack extends SObject {
|
|
*/
|
|
*/
|
|
clear(): void {
|
|
clear(): void {
|
|
this.cmdStack.length = 0;
|
|
this.cmdStack.length = 0;
|
|
- this._index = -1;
|
|
|
|
|
|
+ this.index = -1;
|
|
this.isChange = true;
|
|
this.isChange = true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -137,15 +138,15 @@ export class SUndoStack extends SObject {
|
|
* @param cmd 被添加的命令
|
|
* @param cmd 被添加的命令
|
|
*/
|
|
*/
|
|
push(cmd: SUndoCommand): void {
|
|
push(cmd: SUndoCommand): void {
|
|
- this.cmdStack.length = this._index + 1;
|
|
|
|
|
|
+ this.cmdStack.length = this.index + 1;
|
|
|
|
|
|
// 索引有效而且可以合并命令
|
|
// 索引有效而且可以合并命令
|
|
- if (this._index >= 0 && cmd.mergeWith(this.cmdStack[this._index])) {
|
|
|
|
|
|
+ if (this.index >= 0 && cmd.mergeWith(this.cmdStack[this.index])) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
this.cmdStack.push(cmd);
|
|
this.cmdStack.push(cmd);
|
|
- this._index = this.cmdStack.length - 1;
|
|
|
|
|
|
+ this.index = this.cmdStack.length - 1;
|
|
this.isChange = true;
|
|
this.isChange = true;
|
|
}
|
|
}
|
|
|
|
|