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

Method fitImage

js/main.js:1229–1237  ·  view source on GitHub ↗
(img, mimetype)

Source from the content-addressed store, hash-verified

1227 }
1228
1229 fitImage(img, mimetype) {
1230 this.loadedImageType = mimetype;
1231 this.resize(img.naturalWidth, img.naturalHeight);
1232 this.ctx.drawImage(img, 0, 0);
1233 const minValue = Math.min(this.wrapper.documentClientHeight / this.size.h, this.wrapper.documentClientWidth / this.size.w);
1234 this.zoomFactor = minValue;
1235 this.adjustSizeFull();
1236 this.worklog.captureState();
1237 }
1238
1239 loadImage(source, mimetype) {
1240 this.inserter.handleOpen(source, mimetype);

Callers 2

constructorMethod · 0.80
handleItMethod · 0.80

Calls 3

resizeMethod · 0.95
adjustSizeFullMethod · 0.95
captureStateMethod · 0.80

Tested by

no test coverage detected