Skip to content

Commit

Permalink
Add props for disabling image zoom on scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
subinasr committed Jul 1, 2024
1 parent 4734b06 commit 2f97178
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/ImagePreview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface Props {
src: HTMLImageProps['src'];
alt: HTMLImageProps['alt'];
hideTools?: boolean;
disableZoomOnScroll?: boolean;
}

function ImagePreview(props: Props) {
Expand All @@ -35,6 +36,7 @@ function ImagePreview(props: Props) {
src,
alt,
hideTools,
disableZoomOnScroll,
} = props;

const [expanded, , setExpandedFalse, , toggleExpanded] = useBooleanState(false);
Expand Down Expand Up @@ -65,7 +67,10 @@ function ImagePreview(props: Props) {
>
{pending && <PendingMessage />}
<TransformWrapper
wheel={{ step: 0.2 }}
wheel={{
step: 0.2,
wheelDisabled: disableZoomOnScroll,
}}
centerZoomedOut
centerOnInit
minScale={0.2}
Expand Down

0 comments on commit 2f97178

Please sign in to comment.