(initial)
| 57 | } |
| 58 | |
| 59 | captureState(initial) { |
| 60 | let activeToolName = this.main.activeTool ? this.main.activeTool.name : null; |
| 61 | if (this.main.params.NON_SELECTABLE_TOOLS.includes(activeToolName)) { |
| 62 | activeToolName = this.main.defaultTool.name; |
| 63 | } |
| 64 | |
| 65 | const state = { |
| 66 | sizew: this.main.size.w, |
| 67 | sizeh: this.main.size.h, |
| 68 | activeToolName, |
| 69 | data: this.ctx.getImageData(0, 0, this.main.size.w, this.main.size.h), |
| 70 | }; |
| 71 | if (this.current === null) { |
| 72 | state.prev = null; |
| 73 | state.prevCount = 0; |
| 74 | this.first = state; |
| 75 | this.clearedCount = 0; |
| 76 | } else { |
| 77 | state.prev = this.current; |
| 78 | state.prevCount = this.current.prevCount + 1; |
| 79 | this.current.next = state; |
| 80 | } |
| 81 | state.next = null; |
| 82 | this.current = state; |
| 83 | this.changed(initial); |
| 84 | } |
| 85 | |
| 86 | reCaptureState() { |
| 87 | if (this.current.prev !== null) { |
no test coverage detected