|
|
|
@ -118,7 +118,7 @@ function clearScaledElementStyles(inner: HTMLDivElement, spacer: HTMLDivElement) |
|
|
|
} |
|
|
|
|
|
|
|
function applyScaledElementStyles(inner: HTMLDivElement, spacer: HTMLDivElement, scale: number, viewportWidth: number, viewportHeight: number, designWidth: number, useZoom: boolean): void { |
|
|
|
const scaledInnerWidth = scale > 0 ? Math.max(designWidth, viewportWidth / scale) : designWidth; |
|
|
|
const scaledInnerWidth = scale > 0 ? viewportWidth / scale : designWidth; |
|
|
|
const scaledInnerHeight = viewportHeight > 0 && scale > 0 ? viewportHeight / scale : 0; |
|
|
|
|
|
|
|
inner.style.width = `${String(scaledInnerWidth)}px`; |
|
|
|
@ -184,8 +184,10 @@ export function useLayoutViewportScale(viewportRef: RefObject<HTMLElement | null |
|
|
|
|
|
|
|
const viewportWidth = measureElement?.clientWidth ?? document.documentElement.clientWidth; |
|
|
|
const viewportHeight = measureElement?.clientHeight ?? window.innerHeight; |
|
|
|
const scale = computeLayoutViewportScale(viewportWidth, designWidth); |
|
|
|
const scaling = isLayoutScalingActive(viewportWidth, scale); |
|
|
|
const windowWidth = document.documentElement.clientWidth; |
|
|
|
const scaleBasisWidth = windowWidth >= LAYOUT_SCALE_DISABLE_BELOW ? Math.max(viewportWidth, LAYOUT_SCALE_DISABLE_BELOW) : viewportWidth; |
|
|
|
const scale = computeLayoutViewportScale(scaleBasisWidth, designWidth); |
|
|
|
const scaling = isLayoutScalingActive(windowWidth, scale); |
|
|
|
const host = viewport ?? document.documentElement; |
|
|
|
|
|
|
|
syncHostScaleState(host, scale, scaling, useZoom); |
|
|
|
|