MCPcopy Create free account
hub / github.com/DeepNotesApp/DeepNotes / fixDisplay

Method fixDisplay

apps/client/src/code/pages/page/page.ts:377–407  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

375 }
376
377 fixDisplay() {
378 const pageElem = document.querySelector(
379 `.display-screens[data-page-id="${this.id}"]`,
380 ) as HTMLElement;
381 const worldElem = document.querySelector(
382 `.display-world[data-page-id="${this.id}"]`,
383 ) as HTMLElement;
384
385 if (worldElem == null) {
386 return;
387 }
388
389 const pageRect = pageElem.getBoundingClientRect();
390 const worldRect = worldElem.getBoundingClientRect();
391
392 if (worldRect.x !== pageRect.x || worldRect.y !== pageRect.y) {
393 this.camera.react.pos = this.camera.react.pos.add(
394 this.sizes.screenToWorld2D(
395 new Vec2(pageRect.x, pageRect.y).sub(
396 new Vec2(worldRect.x, worldRect.y),
397 ),
398 ),
399 );
400
401 pageElem.style.position = 'static';
402
403 setTimeout(() => {
404 pageElem.style.position = 'absolute';
405 });
406 }
407 }
408
409 destroy() {
410 this.pinching.destroy();

Callers 6

resetZoomMethod · 0.80
fitToScreenMethod · 0.80
performMethod · 0.80
PagePanningClass · 0.80
PagePinchingClass · 0.80
performMethod · 0.80

Calls 3

screenToWorld2DMethod · 0.80
subMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected