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

Method adjustSizeFull

js/main.js:1363–1397  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1361 }
1362
1363 adjustSizeFull() {
1364 const ratio = this.wrapper.documentClientWidth / this.wrapper.documentClientHeight;
1365
1366 if (this.zoom === false && this.textTool.active === false) {
1367 if (this.size.w > this.wrapper.documentClientWidth ||
1368 this.size.h > this.wrapper.documentClientHeight) {
1369 const newRelation = ratio < this.size.ratio;
1370 this.ratioRelation = newRelation;
1371 if (newRelation) {
1372 this.canvas.style.width = `${this.wrapper.clientWidth}px`;
1373 this.canvas.style.height = 'auto';
1374 } else {
1375 this.canvas.style.width = 'auto';
1376 this.canvas.style.height = `${this.wrapper.clientHeight}px`;
1377 }
1378
1379 } else {
1380 this.canvas.style.width = 'auto';
1381 this.canvas.style.height = 'auto';
1382 this.ratioRelation = 0;
1383 }
1384 this.scroller.style.overflow = 'hidden';
1385 } else {
1386 if (this.zoom === false) {
1387 this.scroller.style.overflow = 'hidden';
1388 } else {
1389 this.scroller.style.overflow = 'scroll';
1390 }
1391 this.canvas.style.width = `${this.size.w * this.zoomFactor}px`;
1392 this.canvas.style.height = `${this.size.h * this.zoomFactor}px`;
1393 this.ratioRelation = 0;
1394 }
1395 this.syncToolElement();
1396 this.select.draw();
1397}
1398
1399 resize(x, y) {
1400 this.info.innerHTML = `${x}<span>x</span>${y}<br>${(this.originalMime || 'png').replace('image/', '')}`;

Callers 10

constructorMethod · 0.95
zoomImageMethod · 0.95
initEventHandlersMethod · 0.95
fitImageMethod · 0.95
setZoomMethod · 0.95
clearMethod · 0.95
applyStateMethod · 0.80
doCropMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80

Calls 2

syncToolElementMethod · 0.95
drawMethod · 0.80

Tested by

no test coverage detected