Skip to content

Commit 9d9b555

Browse files
committed
fix for #170
1 parent b58197e commit 9d9b555

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

js/worklog.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,15 @@ export default class WorkLog {
5757
}
5858

5959
captureState(initial) {
60+
let activeToolName = this.main.activeTool ? this.main.activeTool.name : null;
61+
if (['pixelize', 'crop', 'rotate'].includes(activeToolName)) {
62+
activeToolName = 'select';
63+
}
64+
6065
const state = {
6166
sizew: this.main.size.w,
6267
sizeh: this.main.size.h,
63-
activeToolName: this.main.activeTool ? this.main.activeTool.name : null,
68+
activeToolName,
6469
data: this.ctx.getImageData(0, 0, this.main.size.w, this.main.size.h),
6570
};
6671
if (this.current === null) {
@@ -75,6 +80,7 @@ export default class WorkLog {
7580
}
7681
state.next = null;
7782
this.current = state;
83+
console.log(111, this.current)
7884
this.changed(initial);
7985
}
8086

@@ -93,12 +99,12 @@ export default class WorkLog {
9399
}
94100

95101
undoState() {
102+
console.log(22, this.current.prev);
96103
if (this.current.prev !== null) {
97-
const currentToolName = this.current.activeToolName;
104+
let currentToolName = this.current.activeToolName;
98105
this.current = this.current.prev;
99106
this.applyState(this.current);
100107
this.changed(false);
101-
102108
if (currentToolName) {
103109
this.main.closeActiveTool(true);
104110
this.main.setActiveTool(this.main.toolByName[currentToolName])

0 commit comments

Comments
 (0)