Skip to content

Commit 5e7e979

Browse files
committed
fix(file-viewer): prevent scroll bleed and zoom button micro-pans
1 parent e0374ef commit 5e7e979

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/files/components/file-viewer

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ const ImagePreview = memo(function ImagePreview({ file }: { file: WorkspaceFileR
459459
const el = containerRef.current
460460
if (!el) return
461461
const onWheel = (e: WheelEvent) => {
462+
e.preventDefault()
462463
if (e.ctrlKey || e.metaKey) {
463-
e.preventDefault()
464464
setZoom((z) => clampZoom(z * (1 - e.deltaY * ZOOM_WHEEL_SENSITIVITY)))
465465
} else {
466466
setOffset((o) => ({ x: o.x - e.deltaX, y: o.y - e.deltaY }))
@@ -521,7 +521,10 @@ const ImagePreview = memo(function ImagePreview({ file }: { file: WorkspaceFileR
521521
loading='eager'
522522
/>
523523
</div>
524-
<div className='absolute right-4 bottom-4 flex items-center gap-1 rounded-md border border-[var(--border)] bg-[var(--surface-2)] px-2 py-1 shadow-sm'>
524+
<div
525+
className='absolute right-4 bottom-4 flex items-center gap-1 rounded-md border border-[var(--border)] bg-[var(--surface-2)] px-2 py-1 shadow-sm'
526+
onMouseDown={(e) => e.stopPropagation()}
527+
>
525528
<button
526529
type='button'
527530
onClick={zoomOut}

0 commit comments

Comments
 (0)