MCPcopy Index your code
hub / github.com/PAIR-code/lit / resetScale

Method resetScale

lit_nlp/client/modules/dive_module.ts:509–518  ·  view source on GitHub ↗

Resets the scale of the Megaplot Scene.

()

Source from the content-addressed store, hash-verified

507
508 /** Resets the scale of the Megaplot Scene. */
509 private resetScale() {
510 if (this.container == null || this.scene == null) return;
511 const {width, height} = this.container.getBoundingClientRect();
512 if (width === 0 || height === 0) return;
513 const smaller = height < width ? height : width;
514 this.scene.scale.x = smaller * HEURISTIC_SCALE_FACTOR;
515 this.scene.scale.y = smaller * HEURISTIC_SCALE_FACTOR;
516 this.scene.offset.x = Math.ceil(width / 2);
517 this.scene.offset.y = Math.floor(height / 2) - CELL_PADDING - TEXT_SIZE;
518 }
519
520 /** Resizes the Megaplot Scene canvas and resets the scale. */
521 private resize() {

Callers 3

configureMethod · 0.95
resizeMethod · 0.95
renderControlsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected