MCPcopy Index your code
hub / github.com/CapSoftware/Cap / updateContainerSize

Function updateContainerSize

apps/desktop/src/components/Cropper.tsx:575–593  ·  view source on GitHub ↗
(width: number, height: number)

Source from the content-addressed store, hash-verified

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),

Callers 1

CropperFunction · 0.70

Calls 3

setRawBoundsConstrainingFunction · 0.85
boundsToRawFunction · 0.85
initFunction · 0.70

Tested by

no test coverage detected