(width: number, height: number)
| 573 | let initialized = false; |
| 574 | |
| 575 | const updateContainerSize = (width: number, height: number) => { |
| 576 | const prevScale = logicalScale(); |
| 577 | const currentRaw = rawBounds(); |
| 578 | const preservedReal = { |
| 579 | x: Math.round(currentRaw.x * prevScale.x), |
| 580 | y: Math.round(currentRaw.y * prevScale.y), |
| 581 | width: Math.round(currentRaw.width * prevScale.x), |
| 582 | height: Math.round(currentRaw.height * prevScale.y), |
| 583 | }; |
| 584 | |
| 585 | setContainerSize({ x: width, y: height }); |
| 586 | |
| 587 | setRawBoundsConstraining(boundsToRaw(preservedReal)); |
| 588 | |
| 589 | if (!initialized && width > 1 && height > 1) { |
| 590 | initialized = true; |
| 591 | init(); |
| 592 | } |
| 593 | }; |
| 594 | |
| 595 | createResizeObserver(containerRef, (e) => |
| 596 | updateContainerSize(e.width, e.height), |
no test coverage detected