debug: add verbose logging for quick-escape and precision mode state
Add detailed console logging to debug quick-escape issues: - Log velocity every frame when in precision mode or moving - Show velocity vs threshold and whether escape will trigger - Log when quick-escape actually triggers - Log precision mode state check every frame: - shouldShow, cooldownActive, time remaining - current vs target precision mode state - smallest region size - Log when precision mode state actually changes This will help identify why quick-escape isn't working as expected. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -653,12 +653,23 @@ export function MapRenderer({
|
||||
velocity = distance // Distance in pixels (effectively pixels per frame)
|
||||
}
|
||||
|
||||
// Debug: Log velocity every frame when in precision mode
|
||||
if (precisionMode || velocity > 0) {
|
||||
console.log('[Velocity] Current velocity:', {
|
||||
velocity: velocity.toFixed(1) + 'px/frame',
|
||||
threshold: QUICK_MOVE_THRESHOLD + 'px/frame',
|
||||
willTriggerEscape: velocity > QUICK_MOVE_THRESHOLD,
|
||||
precisionModeActive: precisionMode,
|
||||
timeDelta: timeDelta.toFixed(0) + 'ms',
|
||||
})
|
||||
}
|
||||
|
||||
// Quick escape: If moving fast, cancel dampening and super zoom
|
||||
if (velocity > QUICK_MOVE_THRESHOLD) {
|
||||
const cooldownUntil = now + PRECISION_MODE_COOLDOWN_MS
|
||||
precisionModeCooldownRef.current = cooldownUntil
|
||||
console.log(
|
||||
`[Quick Escape] 💨 Fast movement detected (${velocity.toFixed(0)}px) - canceling precision mode and super zoom (cooldown until ${new Date(cooldownUntil).toLocaleTimeString()})`
|
||||
`[Quick Escape] 💨 TRIGGERED! Fast movement detected (${velocity.toFixed(0)}px > ${QUICK_MOVE_THRESHOLD}px threshold) - canceling precision mode and super zoom (cooldown until ${new Date(cooldownUntil).toLocaleTimeString()})`
|
||||
)
|
||||
setPrecisionMode(false)
|
||||
setSuperZoomActive(false)
|
||||
@@ -861,11 +872,22 @@ export function MapRenderer({
|
||||
// This gives users more control over tiny regions like Jersey
|
||||
// Respect cooldown period after quick-escape to let user escape the area
|
||||
const cooldownActive = now < precisionModeCooldownRef.current
|
||||
const cooldownTimeRemaining = Math.max(0, precisionModeCooldownRef.current - now)
|
||||
const shouldEnablePrecisionMode = shouldShow && !cooldownActive
|
||||
|
||||
// Debug: Log precision mode state every frame
|
||||
console.log('[Precision Mode] State check:', {
|
||||
shouldShow,
|
||||
cooldownActive,
|
||||
cooldownRemaining: cooldownActive ? cooldownTimeRemaining.toFixed(0) + 'ms' : '0ms',
|
||||
currentPrecisionMode: precisionMode,
|
||||
willChangeTo: shouldEnablePrecisionMode,
|
||||
smallestRegion: detectedSmallestSize.toFixed(2) + 'px',
|
||||
})
|
||||
|
||||
if (shouldEnablePrecisionMode !== precisionMode) {
|
||||
console.log(
|
||||
`[Precision Mode] ${shouldEnablePrecisionMode ? '🎯 ENABLING' : '❌ DISABLING'} precision mode (cursor dampening) | Smallest region: ${detectedSmallestSize.toFixed(2)}px${cooldownActive ? ' (COOLDOWN ACTIVE)' : ''}`
|
||||
`[Precision Mode] ⚡ CHANGING STATE: ${shouldEnablePrecisionMode ? '🎯 ENABLING' : '❌ DISABLING'} precision mode | Smallest region: ${detectedSmallestSize.toFixed(2)}px${cooldownActive ? ' (COOLDOWN ACTIVE - ' + cooldownTimeRemaining.toFixed(0) + 'ms remaining)' : ''}`
|
||||
)
|
||||
}
|
||||
setPrecisionMode(shouldEnablePrecisionMode)
|
||||
|
||||
Reference in New Issue
Block a user