提交 df7497c8 编写于 作者: Q qiang

fix: getLocation from GeolocationCoordinates

上级 0d502d80
......@@ -16478,12 +16478,15 @@ const getLocation = /* @__PURE__ */ defineAsyncApi(API_GET_LOCATION, ({type, alt
}, () => resolve2(coords));
});
}).then((coords) => {
resolve(Object.assign({}, coords, {
resolve({
latitude: coords.latitude,
longitude: coords.longitude,
accuracy: coords.accuracy,
speed: coords.altitude || 0,
altitude: coords.altitude || 0,
verticalAccuracy: coords.altitudeAccuracy || 0,
horizontalAccuracy: coords.accuracy || 0
}));
});
}).catch((error) => {
reject(error.message);
});
......
......@@ -85,15 +85,16 @@ export const getLocation = <API_TYPE_GET_LOCATION>defineAsyncApi(
})
})
.then((coords: GeolocationCoordinates) => {
resolve(
Object.assign({}, coords, {
speed: coords.altitude || 0,
altitude: coords.altitude || 0,
verticalAccuracy: coords.altitudeAccuracy || 0,
// 无专门水平精度,使用位置精度替代
horizontalAccuracy: coords.accuracy || 0,
})
)
resolve({
latitude: coords.latitude,
longitude: coords.longitude,
accuracy: coords.accuracy,
speed: coords.altitude || 0,
altitude: coords.altitude || 0,
verticalAccuracy: coords.altitudeAccuracy || 0,
// 无专门水平精度,使用位置精度替代
horizontalAccuracy: coords.accuracy || 0,
})
})
.catch((error) => {
reject(error.message)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册