MCPcopy Create free account
hub / github.com/devforth/painterro / init

Method init

js/inserter.js:145–167  ·  view source on GitHub ↗
(main)

Source from the content-addressed store, hash-verified

143 }
144
145 init(main) {
146 this.CLIP_DATA_MARKER = 'painterro-image-data';
147 this.ctx = main.ctx;
148 this.main = main;
149 this.worklog = main.worklog;
150 this.selector = main.wrapper.querySelector('.ptro-paster-select-wrapper');
151 this.cancelChoosing();
152 this.img = null;
153 this.mimetype = null; // mime of pending image
154 this.getAvailableOptions().forEach((k) => {
155 const o = this.pasteOptions[k];
156 this.main.getElemByIdSafe(o.id).onclick = () => {
157 if (this.loading) {
158 this.doLater = o.handle;
159 } else {
160 o.handle(this.img);
161 }
162 this.cancelChoosing();
163 };
164 });
165 this.loading = false;
166 this.doLater = null;
167 }
168
169 insert(x, y, w, h) {
170 this.main.ctx.drawImage(this.tmpImg, x, y, w, h);

Callers 2

constructorMethod · 0.95
constructorMethod · 0.45

Calls 2

cancelChoosingMethod · 0.95
getAvailableOptionsMethod · 0.95

Tested by

no test coverage detected