Skip to content

Commit 4957b65

Browse files
committed
fix(image): Prevent default drag ghost on zoomed images
1 parent 4639b3b commit 4957b65

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/hooks/features/image-viewer/useImageDrag.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ export function useImageDrag({
2424

2525
const handleMouseDown = useCallback(
2626
(e: React.MouseEvent) => {
27-
if (scale <= minScale) return
27+
// Only handle primary button drag when zoomed in
28+
if (e.button !== 0 || scale <= minScale) return
29+
30+
// Prevent browser default drag behavior (e.g., dragging the image/canvas ghost)
31+
e.preventDefault()
32+
2833
setIsDragging(true)
2934
dragStartRef.current = {
3035
x: e.clientX,

0 commit comments

Comments
 (0)