feat: make super zoom threshold configurable and increase to 3px

Add SUPER_ZOOM_SIZE_THRESHOLD constant (default: 3px)
- Previously hardcoded at < 1px (only sub-pixel regions)
- Now activates for regions < 3px (more helpful range)
- Easy to tune for different preferences

Update logging to reference the configurable threshold.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-11-19 10:08:40 -06:00
parent 814bf949f2
commit d7ce474a51
1 changed files with 6 additions and 5 deletions

View File

@ -178,6 +178,7 @@ export function MapRenderer({
const HOVER_DELAY_MS = 500 // Time to hover before super zoom activates
const QUICK_MOVE_THRESHOLD = 50 // Pixels per frame - exceeding this cancels super zoom
const SUPER_ZOOM_MULTIPLIER = 2.5 // Super zoom is 2.5x the normal adaptive zoom
const SUPER_ZOOM_SIZE_THRESHOLD = 3 // Activate super zoom for regions smaller than this (in pixels)
// Movement speed multiplier based on smallest region size
// When pointer lock is active, apply this multiplier to movementX/movementY
@ -867,11 +868,11 @@ export function MapRenderer({
setHoveredRegion(regionUnderCursor)
}
// Auto super-zoom on hover: If hovering over sub-pixel regions (< 1px), start timer
const shouldEnableSuperZoom = detectedSmallestSize < 1 && shouldShow
// Auto super-zoom on hover: If hovering over very tiny regions, start timer
const shouldEnableSuperZoom = detectedSmallestSize < SUPER_ZOOM_SIZE_THRESHOLD && shouldShow
if (shouldEnableSuperZoom && !hoverTimerRef.current && !superZoomActive) {
console.log(
`[Super Zoom] ⏱️ Starting hover timer (${HOVER_DELAY_MS}ms) for sub-pixel region: ${detectedSmallestSize.toFixed(2)}px`
`[Super Zoom] ⏱️ Starting hover timer (${HOVER_DELAY_MS}ms) for tiny region: ${detectedSmallestSize.toFixed(2)}px (threshold: ${SUPER_ZOOM_SIZE_THRESHOLD}px)`
)
hoverTimerRef.current = setTimeout(() => {
console.log('[Super Zoom] 🔍 ACTIVATING super zoom!')
@ -879,8 +880,8 @@ export function MapRenderer({
hoverTimerRef.current = null
}, HOVER_DELAY_MS)
} else if (!shouldEnableSuperZoom && hoverTimerRef.current) {
// Cancel timer if we move away from sub-pixel regions
console.log('[Super Zoom] ❌ Canceling hover timer (moved away from sub-pixel region)')
// Cancel timer if we move away from tiny regions
console.log('[Super Zoom] ❌ Canceling hover timer (moved away from tiny region)')
clearTimeout(hoverTimerRef.current)
hoverTimerRef.current = null
} else if (!shouldShow && superZoomActive) {