|
|
|
@ -6868,11 +6868,8 @@ |
|
|
|
|
|
|
|
// Move once in the specified direction |
|
|
|
const doMove = (dir) => { |
|
|
|
console.log('doMove called:', dir, 'gpsTestMode:', gpsTestMode); |
|
|
|
|
|
|
|
// Auto-enable GPS test mode if not already enabled |
|
|
|
if (!gpsTestMode) { |
|
|
|
console.log('Auto-enabling GPS test mode'); |
|
|
|
// Initialize test position to current map center or user location |
|
|
|
if (userLocation) { |
|
|
|
testPosition = { lat: userLocation.lat, lng: userLocation.lng }; |
|
|
|
@ -6948,7 +6945,6 @@ |
|
|
|
|
|
|
|
// Start moving (on press/touch start) |
|
|
|
const startMove = (e, dir) => { |
|
|
|
console.log('startMove called:', dir); |
|
|
|
e.preventDefault(); |
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
@ -6963,12 +6959,10 @@ |
|
|
|
doMove(wasdCurrentDir); |
|
|
|
} |
|
|
|
}, 100); // Move every 100ms while held |
|
|
|
console.log('Interval started, wasdMoveInterval:', wasdMoveInterval); |
|
|
|
}; |
|
|
|
|
|
|
|
// Stop moving (on release) |
|
|
|
const stopMove = () => { |
|
|
|
console.log('stopMove called, clearing interval:', wasdMoveInterval); |
|
|
|
wasdCurrentDir = null; |
|
|
|
if (wasdMoveInterval) { |
|
|
|
clearInterval(wasdMoveInterval); |
|
|
|
@ -6982,7 +6976,6 @@ |
|
|
|
let isPressed = false; |
|
|
|
|
|
|
|
btn.addEventListener('pointerdown', (e) => { |
|
|
|
console.log('pointerdown on', dir, 'button'); |
|
|
|
e.preventDefault(); |
|
|
|
e.stopPropagation(); |
|
|
|
isPressed = true; |
|
|
|
@ -6991,7 +6984,6 @@ |
|
|
|
}); |
|
|
|
|
|
|
|
btn.addEventListener('pointerup', (e) => { |
|
|
|
console.log('pointerup on', dir, 'button, isPressed:', isPressed); |
|
|
|
e.preventDefault(); |
|
|
|
e.stopPropagation(); |
|
|
|
if (isPressed) { |
|
|
|
@ -7002,7 +6994,6 @@ |
|
|
|
}); |
|
|
|
|
|
|
|
btn.addEventListener('pointercancel', (e) => { |
|
|
|
console.log('pointercancel on', dir, 'button'); |
|
|
|
if (isPressed) { |
|
|
|
isPressed = false; |
|
|
|
btn.releasePointerCapture(e.pointerId); |
|
|
|
@ -7012,7 +7003,6 @@ |
|
|
|
|
|
|
|
// Handle lost pointer capture (e.g., when element is hidden) |
|
|
|
btn.addEventListener('lostpointercapture', (e) => { |
|
|
|
console.log('lostpointercapture on', dir, 'button'); |
|
|
|
if (isPressed) { |
|
|
|
isPressed = false; |
|
|
|
stopMove(); |
|
|
|
|