()
| 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(); |
no test coverage detected