MCPcopy Index your code
hub / github.com/devforth/painterro / captureState

Method captureState

js/worklog.js:59–84  ·  view source on GitHub ↗
(initial)

Source from the content-addressed store, hash-verified

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) {

Callers 13

reCaptureStateMethod · 0.95
doCropMethod · 0.80
doPixelizeMethod · 0.80
doClearAreaMethod · 0.80
applyFilterMethod · 0.80
applyMethod · 0.80
constructorMethod · 0.80
fitImageMethod · 0.80
clearMethod · 0.80
constructorMethod · 0.80
paintAtMethod · 0.80
handleMouseUpMethod · 0.80

Calls 1

changedMethod · 0.95

Tested by

no test coverage detected