asdfasf
This commit is contained in:
@@ -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'));
|
||||
|
||||
Reference in New Issue
Block a user