Skip to content

Commit

Permalink
fix for #170
Browse files Browse the repository at this point in the history
  • Loading branch information
ivictbor committed May 5, 2022
1 parent b58197e commit 9d9b555
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions js/worklog.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,15 @@ export default class WorkLog {
}

captureState(initial) {
let activeToolName = this.main.activeTool ? this.main.activeTool.name : null;
if (['pixelize', 'crop', 'rotate'].includes(activeToolName)) {
activeToolName = 'select';
}

const state = {
sizew: this.main.size.w,
sizeh: this.main.size.h,
activeToolName: this.main.activeTool ? this.main.activeTool.name : null,
activeToolName,
data: this.ctx.getImageData(0, 0, this.main.size.w, this.main.size.h),
};
if (this.current === null) {
Expand All @@ -75,6 +80,7 @@ export default class WorkLog {
}
state.next = null;
this.current = state;
console.log(111, this.current)
this.changed(initial);
}

Expand All @@ -93,12 +99,12 @@ export default class WorkLog {
}

undoState() {
console.log(22, this.current.prev);
if (this.current.prev !== null) {
const currentToolName = this.current.activeToolName;
let currentToolName = this.current.activeToolName;
this.current = this.current.prev;
this.applyState(this.current);
this.changed(false);

if (currentToolName) {
this.main.closeActiveTool(true);
this.main.setActiveTool(this.main.toolByName[currentToolName])
Expand Down

0 comments on commit 9d9b555

Please sign in to comment.