This commit is contained in:
Jake Kasper
2025-09-05 12:22:01 -04:00
parent e1340a1e50
commit 3fc77a0683

View File

@@ -561,7 +561,7 @@ const PropertyDetail = () => {
if (!navigator.geolocation) { toast.error('GPS not available'); return; }
// Prefer most accurate recent fix from warm watch; fall back to immediate read
const candidate = bestRecentSample();
const useFix = (lat, lng, acc) => {
const applyFix = (lat, lng, acc) => {
setGpsAccuracy(acc || null);
setGpsTracePoints(prev => {
const normalized = acceptAndNormalizePoint(lat, lng, acc, prev);
@@ -581,12 +581,12 @@ const PropertyDetail = () => {
};
if (candidate) {
const [lat, lng, acc] = candidate;
useFix(lat, lng, acc);
applyFix(lat, lng, acc);
} else {
navigator.geolocation.getCurrentPosition((pos) => {
const { latitude, longitude, accuracy } = pos.coords;
addSampleAndSmooth(latitude, longitude, accuracy);
useFix(latitude, longitude, accuracy);
applyFix(latitude, longitude, accuracy);
}, (err)=>{
console.warn('GPS error', err?.message);
toast.error('GPS error: ' + (err?.message || 'unknown'));