Merge branch 'main' into next

This commit is contained in:
nocobase[bot] 2024-11-27 07:35:57 +00:00
commit 9d3e3bd010
2 changed files with 8 additions and 5 deletions

View File

@ -164,9 +164,9 @@ export const GoogleMapsComponent = React.forwardRef<GoogleMapForwardedRefProps,
});
const toCenter = useMemoizedFn((position) => {
if (map.current) {
map.current.setCenter(position);
map.current.setZoom(zoom);
if (map.current && position) {
map.current?.setCenter(position);
map.current?.setZoom(zoom);
}
});
@ -192,7 +192,7 @@ export const GoogleMapsComponent = React.forwardRef<GoogleMapForwardedRefProps,
}
});
map.current.setCenter(bounds.getCenter());
map.current?.setCenter?.(bounds.getCenter());
});
const onFocusOverlay = () => {
@ -386,7 +386,6 @@ export const GoogleMapsComponent = React.forwardRef<GoogleMapForwardedRefProps,
});
});
const app = useApp();
if (!accessKey || errMessage) {
return (
<Alert

View File

@ -34,6 +34,10 @@ export const getCurrentPosition: () => Promise<{ lat: number; lng: number }> = (
() => {
defaultLatLng();
},
{
timeout: 2000, // 设置最大等待时间,单位毫秒
maximumAge: 0, // 不使用缓存的地理位置
},
);
} else {
defaultLatLng();