fix(know-your-world): Remove redundant preventDefault calls in touch handlers
Remove e.preventDefault() calls from touch handlers that were causing "Unable to preventDefault inside passive event listener" warnings. The container already has touchAction: 'none' CSS which prevents browser gestures (scrolling, zooming) without needing preventDefault(). React marks touch events as passive by default, so preventDefault() doesn't work and just triggers console warnings. Affected handlers: - handleContainerTouchMove (mobile map drag) - handleMagnifierTouchStart (pinch start, drag start) - handleMagnifierTouchMove (pinch zoom, pan) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ca1f60c3c6
commit
021a75f583
|
|
@ -2292,8 +2292,7 @@ export function MapRenderer({
|
||||||
|
|
||||||
// Once we detect a drag (moved past threshold), show magnifier and update cursor
|
// Once we detect a drag (moved past threshold), show magnifier and update cursor
|
||||||
if (distance >= MOBILE_DRAG_THRESHOLD) {
|
if (distance >= MOBILE_DRAG_THRESHOLD) {
|
||||||
// Prevent default to stop text selection and other browser gestures
|
// Note: touchAction: 'none' CSS prevents browser gestures without needing preventDefault()
|
||||||
e.preventDefault()
|
|
||||||
|
|
||||||
if (!isMobileMapDragging) {
|
if (!isMobileMapDragging) {
|
||||||
setIsMobileMapDragging(true)
|
setIsMobileMapDragging(true)
|
||||||
|
|
@ -2517,7 +2516,7 @@ export function MapRenderer({
|
||||||
setIsMagnifierExpanded(true) // Expand magnifier to fill leftover area during pinch
|
setIsMagnifierExpanded(true) // Expand magnifier to fill leftover area during pinch
|
||||||
setIsMagnifierDragging(false) // Cancel any single-finger drag
|
setIsMagnifierDragging(false) // Cancel any single-finger drag
|
||||||
magnifierTouchStartRef.current = null
|
magnifierTouchStartRef.current = null
|
||||||
e.preventDefault()
|
// Note: touchAction: 'none' CSS prevents browser gestures
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2537,7 +2536,7 @@ export function MapRenderer({
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsMagnifierDragging(true)
|
setIsMagnifierDragging(true)
|
||||||
e.preventDefault() // Prevent scrolling
|
// Note: touchAction: 'none' CSS prevents scrolling
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[getTouchDistance, getCurrentZoom]
|
[getTouchDistance, getCurrentZoom]
|
||||||
|
|
@ -2561,7 +2560,7 @@ export function MapRenderer({
|
||||||
setTargetZoom(newZoom)
|
setTargetZoom(newZoom)
|
||||||
}
|
}
|
||||||
|
|
||||||
e.preventDefault()
|
// Note: touchAction: 'none' CSS prevents browser zoom gestures
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2708,7 +2707,8 @@ export function MapRenderer({
|
||||||
onCursorUpdate({ x: cursorSvgX, y: cursorSvgY }, regionUnderCursor)
|
onCursorUpdate({ x: cursorSvgX, y: cursorSvgY }, regionUnderCursor)
|
||||||
}
|
}
|
||||||
|
|
||||||
e.preventDefault() // Prevent scrolling
|
// Note: No preventDefault() needed here - the container has touchAction: 'none' CSS
|
||||||
|
// which prevents scrolling without triggering passive event listener warnings
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
isMagnifierDragging,
|
isMagnifierDragging,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue