Skip to content

Commit 7a5c6ec

Browse files
author
Tim Sinaeve
committed
Fix MD zoom-in reflow with CSS zoom
1 parent c0b3933 commit 7a5c6ec

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

components/ZoomPanContainer.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,25 @@ const ZoomPanContainer = React.forwardRef<HTMLDivElement, ZoomPanContainerProps>
232232
return undefined;
233233
}
234234

235+
// When using CSS zoom, the wrapper width needs inverse scaling
236+
// so the zoomed content fills the available space properly
237+
if (useZoomProperty) {
238+
// At 100% zoom, width is 100%. Below 100%, width stays 100%.
239+
// Above 100%, we don't need to adjust as CSS zoom handles expansion
240+
return {
241+
width: '100%',
242+
minHeight: '100%',
243+
};
244+
}
245+
235246
const visualScale = Math.max(1, scale);
236247

237248
return {
238249
width: `${visualScale * 100}%`,
239250
minWidth: `${visualScale * 100}%`,
240251
minHeight: `${visualScale * 100}%`,
241252
};
242-
}, [disablePan, layout, scale]);
253+
}, [disablePan, layout, scale, useZoomProperty]);
243254

244255
const containerClasses = useMemo(() => {
245256
const classes = ['relative', 'bg-secondary'];

0 commit comments

Comments
 (0)