Compare commits

...

3 Commits

Author SHA1 Message Date
Claire Chabas af08dec963 Add changeset 2025-05-22 13:44:59 +02:00
Claire Chabas 929a0cf264 Clean 2025-05-22 13:42:37 +02:00
Claire Chabas 969cfa80fe Open image zoon viewer on click for any image size 2025-05-22 13:38:50 +02:00
2 changed files with 5 additions and 7 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"gitbook": patch
---
Open image zoom viewer for all image sizes
@@ -32,9 +32,6 @@ export function ZoomImage(
return;
}
const imageWidth = typeof width === 'number' ? width : 0;
let viewWidth = 0;
const mediaQueryList = window.matchMedia('(min-width: 768px)');
const resizeObserver =
typeof ResizeObserver !== 'undefined'
@@ -44,7 +41,6 @@ export function ZoomImage(
// Since the image is removed from the DOM when the modal is opened,
// We only care when the size is defined.
if (imgEntry && imgEntry.contentRect.width !== 0) {
viewWidth = entries[0]?.contentRect.width;
setPlaceholderRect(entries[0].contentRect);
onChange();
}
@@ -55,9 +51,6 @@ export function ZoomImage(
if (!mediaQueryList.matches) {
// Don't allow zooming on mobile
setZoomable(false);
} else if (resizeObserver && imageWidth && viewWidth && imageWidth <= viewWidth) {
// Image can't be zoomed if it's already rendered as it's largest size
setZoomable(false);
} else {
setZoomable(true);
}