This commit is contained in:
Jake Kasper
2025-09-05 11:52:52 -04:00
parent ee69c6c99a
commit 2b9a54b965
2 changed files with 18 additions and 1 deletions

View File

@@ -588,6 +588,8 @@ const PropertyDetail = () => {
setGpsTracePoints([]);
setGpsDistance(0);
setGpsAccuracy(null);
// Stop passive watch if running (used for Points mode warmup)
if (gpsWatchId) { navigator.geolocation.clearWatch(gpsWatchId); setGpsWatchId(null); }
};
const completeTracing = () => {
@@ -1142,6 +1144,18 @@ const PropertyDetail = () => {
if (gpsWatchId) { navigator.geolocation.clearWatch(gpsWatchId); setGpsWatchId(null); }
clearGpsPoints();
setIsGPSPointsMode(true);
// Start passive GPS watch to warm up accuracy for Points mode
if (navigator.geolocation) {
const id = navigator.geolocation.watchPosition((pos)=>{
const { latitude, longitude, accuracy } = pos.coords;
setGpsAccuracy(accuracy || null);
// Populate smoothing buffer without adding a point yet
try { addSampleAndSmooth(latitude, longitude, accuracy); } catch {}
}, (err)=>{
console.warn('GPS warmup error', err?.message);
}, { enableHighAccuracy: true, maximumAge: 1000, timeout: 15000 });
setGpsWatchId(id);
}
}}
>
<div className="font-medium">GPS Points (walk and mark)</div>