expo-gaode-map-navigation 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -1
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapView.kt +182 -86
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapViewModule.kt +5 -2
- package/android/src/main/java/expo/modules/gaodemap/map/managers/UIManager.kt +19 -5
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerView.kt +319 -48
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerViewModule.kt +3 -3
- package/build/index.d.ts +8 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +79 -1
- package/build/index.js.map +1 -1
- package/build/map/ExpoGaodeMapModule.d.ts +4 -4
- package/build/map/ExpoGaodeMapModule.d.ts.map +1 -1
- package/build/map/ExpoGaodeMapModule.js +10 -8
- package/build/map/ExpoGaodeMapModule.js.map +1 -1
- package/build/map/ExpoGaodeMapView.d.ts.map +1 -1
- package/build/map/ExpoGaodeMapView.js +79 -17
- package/build/map/ExpoGaodeMapView.js.map +1 -1
- package/build/map/components/overlays/Cluster.d.ts.map +1 -1
- package/build/map/components/overlays/Cluster.js +12 -0
- package/build/map/components/overlays/Cluster.js.map +1 -1
- package/build/map/components/overlays/Marker.d.ts.map +1 -1
- package/build/map/components/overlays/Marker.js +70 -6
- package/build/map/components/overlays/Marker.js.map +1 -1
- package/build/map/types/common.types.d.ts +29 -5
- package/build/map/types/common.types.d.ts.map +1 -1
- package/build/map/types/common.types.js +5 -5
- package/build/map/types/common.types.js.map +1 -1
- package/build/map/types/index.d.ts +2 -1
- package/build/map/types/index.d.ts.map +1 -1
- package/build/map/types/index.js.map +1 -1
- package/build/map/types/location.types.d.ts +23 -0
- package/build/map/types/location.types.d.ts.map +1 -1
- package/build/map/types/location.types.js.map +1 -1
- package/build/map/types/map-view.types.d.ts +20 -22
- package/build/map/types/map-view.types.d.ts.map +1 -1
- package/build/map/types/map-view.types.js.map +1 -1
- package/build/map/types/overlays.types.d.ts +9 -2
- package/build/map/types/overlays.types.d.ts.map +1 -1
- package/build/map/types/overlays.types.js.map +1 -1
- package/build/map/types/route-playback.types.d.ts +12 -0
- package/build/map/types/route-playback.types.d.ts.map +1 -0
- package/build/map/types/route-playback.types.js +2 -0
- package/build/map/types/route-playback.types.js.map +1 -0
- package/build/types/route.types.d.ts +10 -1
- package/build/types/route.types.d.ts.map +1 -1
- package/build/types/route.types.js +2 -0
- package/build/types/route.types.js.map +1 -1
- package/ios/map/ExpoGaodeMapView.swift +151 -76
- package/ios/map/ExpoGaodeMapViewModule.swift +14 -1
- package/ios/map/managers/UIManager.swift +5 -4
- package/ios/map/overlays/ClusterView.swift +207 -147
- package/ios/map/overlays/ClusterViewModule.swift +5 -1
- package/ios/map/overlays/MarkerView.swift +214 -60
- package/ios/map/overlays/MarkerViewModule.swift +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoGaodeMapView.js","sourceRoot":"","sources":["../../src/map/ExpoGaodeMapView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAIhD,MAAM,aAAa,GAAG,2BAA2B,CAAiD,kBAAkB,CAAC,CAAC;AAGtH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,gBA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AAM,UAAU,GAAsB,EAAE,CAAC;IAEzC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;QACzC,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAK,KAAK,CAAC,IAA8B,EAAE,OAAO,CAAC,EAAE,CAAC;YAC5G,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CACjC;MAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAC,CAC3E;QAAA,CAAC,UAAU,CACT,GAAG,CAAC,CAAC,SAAS,CAAC,CACf,KAAK,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAC/B,IAAI,UAAU,CAAC,CAEf;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,UAAU,CACZ;QAAA,CAAC,UAAU,CACb;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,UAAU,CAAC,QAAQ,CAAC,CACvB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AAElD,eAAe,gBAAgB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport type {\n MapViewProps,\n MapViewRef,\n CameraPosition,\n LatLng,\n Point,\n LatLngPoint,\n} from './types';\nimport ExpoGaodeMapModule from './ExpoGaodeMapModule';\nimport { normalizeLatLng } from './utils/GeoUtils';\nimport { ErrorHandler } from './utils/ErrorHandler';\nimport { MapContext } from './components/MapContext';\nimport { MapUI } from './components/MapUI';\nimport { createLazyNativeViewManager } from './utils/lazyNativeViewManager';\nimport { View, StyleSheet } from 'react-native';\n\nexport type { MapViewRef } from './types';\n\nconst getNativeView = createLazyNativeViewManager<MapViewProps & { ref?: React.Ref<MapViewRef> }>('ExpoGaodeMapView');\n\n\n/**\n * 高德地图视图组件,提供地图操作API和覆盖物管理功能\n * \n * @param props - 组件属性\n * @param ref - 外部ref引用,用于访问地图API方法\n * @returns 返回包含地图视图和上下文提供者的React组件\n * \n * @remarks\n * 该组件内部维护两个ref:\n * - nativeRef: 指向原生地图视图的引用\n * - internalRef: 内部使用的API引用,通过MapContext共享\n * \n * 提供的主要API功能包括:\n * - 相机控制(移动、缩放、获取当前位置)\n * - 覆盖物管理(添加/删除/更新标记、折线、多边形、圆形等)\n * \n * 所有API方法都会检查地图是否已初始化,未初始化时抛出错误\n */\nconst ExpoGaodeMapView = React.forwardRef<MapViewRef, MapViewProps>((props, ref) => {\n const privacyStatus = ExpoGaodeMapModule.getPrivacyStatus();\n if (!privacyStatus.isReady) {\n throw ErrorHandler.privacyNotAgreed('map');\n }\n\n const nativeRef = React.useRef<MapViewRef>(null);\n const internalRef = React.useRef<MapViewRef | null>(null);\n const NativeView = React.useMemo(() => getNativeView(), []);\n \n /**\n * 🔑 性能优化:通用 API 方法包装器\n * 统一处理初始化检查和错误处理,减少重复代码\n */\n const createApiMethod = React.useCallback(<T extends (...args: never[]) => unknown>(\n methodName: keyof MapViewRef\n ) => {\n return ((...args: Parameters<T>) => {\n if (!nativeRef.current) {\n throw ErrorHandler.mapViewNotInitialized(methodName as string);\n }\n try {\n return (nativeRef.current[methodName] as T)(...args);\n } catch (error) {\n throw ErrorHandler.wrapNativeError(error, methodName as string);\n }\n }) as T;\n }, []);\n\n /**\n * 使用通用包装器创建所有 API 方法\n * 所有方法共享相同的错误处理逻辑\n */\n const apiRef: MapViewRef = React.useMemo(() => ({\n moveCamera: (position: CameraPosition, duration?: number) => {\n if (!nativeRef.current) {\n throw ErrorHandler.mapViewNotInitialized('moveCamera');\n }\n const normalizedPosition = {\n ...position,\n target: position.target ? normalizeLatLng(position.target) : undefined,\n };\n return nativeRef.current.moveCamera(normalizedPosition, duration);\n },\n getLatLng: createApiMethod<(point: Point) => Promise<LatLng>>('getLatLng'),\n setCenter: (center: LatLngPoint, animated?: boolean) => {\n if (!nativeRef.current) {\n throw ErrorHandler.mapViewNotInitialized('setCenter');\n }\n return nativeRef.current.setCenter(normalizeLatLng(center), animated);\n },\n setZoom: createApiMethod<(zoom: number, animated?: boolean) => Promise<void>>('setZoom'),\n getCameraPosition: createApiMethod<() => Promise<CameraPosition>>('getCameraPosition'),\n takeSnapshot: createApiMethod<() => Promise<string>>('takeSnapshot'),\n }), [createApiMethod]);\n\n /**\n * 将传入的apiRef赋值给internalRef.current\n * 用于在组件内部保存对地图API实例的引用\n */\n React.useEffect(() => {\n internalRef.current = apiRef;\n }, [apiRef]);\n\n /**\n * 获取当前地图实例的API引用\n * @returns 返回地图API的引用对象,可用于调用地图相关方法\n */\n React.useImperativeHandle(ref, () => apiRef, [apiRef]);\n\n // 分离 children:区分原生覆盖物和普通 UI 组件\n const { children, style, ...otherProps } = props;\n const overlays: React.ReactNode[] = [];\n const uiControls: React.ReactNode[] = [];\n\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child) && (child.type === MapUI || (child.type as { isMapUI?: boolean })?.isMapUI)) {\n uiControls.push(child);\n } else {\n overlays.push(child);\n }\n });\n\n return (\n <MapContext.Provider value={apiRef}>\n <View style={[{ flex: 1, position: 'relative', overflow: 'hidden' ,}, style]}>\n <NativeView\n ref={nativeRef}\n style={StyleSheet.absoluteFill}\n {...otherProps}\n >\n {overlays}\n </NativeView>\n {uiControls}\n </View>\n </MapContext.Provider>\n );\n});\n\nExpoGaodeMapView.displayName = 'ExpoGaodeMapView';\n\nexport default ExpoGaodeMapView;\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoGaodeMapView.js","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AI,UAAU,CAAC,CAEf;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,UAAU,CACZ;QAAA,CAAC,UAAU,CACb;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,UAAU,CAAC,QAAQ,CAAC,CACvB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AAElD,eAAe,gBAAgB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport type {\n MapViewProps,\n MapViewRef,\n CameraPosition,\n CameraUpdate,\n LatLng,\n Point,\n LatLngPoint,\n} from './types';\nimport ExpoGaodeMapModule from './ExpoGaodeMapModule';\nimport { normalizeLatLng } from './utils/GeoUtils';\nimport { ErrorHandler } from './utils/ErrorHandler';\nimport { MapContext } from './components/MapContext';\nimport { MapUI } from './components/MapUI';\nimport { createLazyNativeViewManager } from './utils/lazyNativeViewManager';\nimport { View, StyleSheet } from 'react-native';\nimport type { FitToCoordinatesOptions } from './types/route-playback.types';\n\nexport type { MapViewRef } from './types';\n\nconst getNativeView = createLazyNativeViewManager<MapViewProps & { ref?: React.Ref<MapViewRef> }>('ExpoGaodeMapView');\nconst MIN_ZOOM = 3;\nconst MAX_ZOOM = 20;\n\nfunction estimateZoom(latitudeDelta: number, longitudeDelta: number, options?: FitToCoordinatesOptions) {\n const span = Math.max(latitudeDelta, longitudeDelta, 0.0001);\n const rawZoom = Math.log2(360 / span);\n return Math.max(options?.minZoom ?? MIN_ZOOM, Math.min(options?.maxZoom ?? MAX_ZOOM, Number(rawZoom.toFixed(2))));\n}\n\n\n/**\n * 高德地图视图组件,提供地图操作API和覆盖物管理功能\n * \n * @param props - 组件属性\n * @param ref - 外部ref引用,用于访问地图API方法\n * @returns 返回包含地图视图和上下文提供者的React组件\n * \n * @remarks\n * 该组件内部维护两个ref:\n * - nativeRef: 指向原生地图视图的引用\n * - internalRef: 内部使用的API引用,通过MapContext共享\n * \n * 提供的主要API功能包括:\n * - 相机控制(移动、缩放、获取当前位置)\n * - 覆盖物管理(添加/删除/更新标记、折线、多边形、圆形等)\n * \n * 所有API方法都会检查地图是否已初始化,未初始化时抛出错误\n */\nconst ExpoGaodeMapView = React.forwardRef<MapViewRef, MapViewProps>((props, ref) => {\n const privacyStatus = ExpoGaodeMapModule.getPrivacyStatus();\n if (!privacyStatus.isReady) {\n throw ErrorHandler.privacyNotAgreed('map');\n }\n\n const nativeRef = React.useRef<MapViewRef>(null);\n const internalRef = React.useRef<MapViewRef | null>(null);\n const NativeView = React.useMemo(() => getNativeView(), []);\n\n const callNativeMethod = React.useCallback(<T extends (...args: never[]) => unknown>(\n methodName: keyof MapViewRef,\n ...args: Parameters<T>\n ) => {\n if (!nativeRef.current) {\n throw ErrorHandler.mapViewNotInitialized(methodName as string);\n }\n\n const nativeMethod = Reflect.get(\n nativeRef.current as object,\n methodName,\n nativeRef.current as object\n );\n\n if (typeof nativeMethod !== 'function') {\n throw new Error(`Method '${methodName}' is not available on native view. Make sure the native module is linked and rebuilt.`);\n }\n\n return (nativeMethod as (...methodArgs: Parameters<T>) => ReturnType<T>).apply(\n nativeRef.current,\n args\n );\n }, []);\n \n /**\n * 🔑 性能优化:通用 API 方法包装器\n * 统一处理初始化检查和错误处理,减少重复代码\n */\n const createApiMethod = React.useCallback(<T extends (...args: never[]) => unknown>(\n methodName: keyof MapViewRef\n ) => {\n return ((...args: Parameters<T>) => {\n try {\n return callNativeMethod<T>(methodName, ...args);\n } catch (error) {\n throw ErrorHandler.wrapNativeError(error, methodName as string);\n }\n }) as T;\n }, [callNativeMethod]);\n\n /**\n * 使用通用包装器创建所有 API 方法\n * 所有方法共享相同的错误处理逻辑\n */\n const apiRef: MapViewRef = React.useMemo(() => ({\n moveCamera: (position: CameraUpdate, duration?: number) => {\n try {\n const normalizedPosition = {\n ...position,\n target: position.target ? normalizeLatLng(position.target) : undefined,\n };\n return callNativeMethod<(cameraPosition: CameraUpdate, animationDuration: number) => Promise<void>>(\n 'moveCamera',\n normalizedPosition,\n duration ?? 0\n );\n } catch (error) {\n throw ErrorHandler.wrapNativeError(error, 'moveCamera');\n }\n },\n getLatLng: createApiMethod<(point: Point) => Promise<LatLng>>('getLatLng'),\n setCenter: (center: LatLngPoint, animated?: boolean) => {\n try {\n return callNativeMethod<(normalizedCenter: LatLng, animatedFlag: boolean) => Promise<void>>(\n 'setCenter',\n normalizeLatLng(center),\n animated ?? false\n );\n } catch (error) {\n throw ErrorHandler.wrapNativeError(error, 'setCenter');\n }\n },\n setZoom: (zoom: number, animated?: boolean) => {\n try {\n return callNativeMethod<(zoomLevel: number, animatedFlag: boolean) => Promise<void>>(\n 'setZoom',\n zoom,\n animated ?? false\n );\n } catch (error) {\n throw ErrorHandler.wrapNativeError(error, 'setZoom');\n }\n },\n getCameraPosition: createApiMethod<() => Promise<CameraPosition>>('getCameraPosition'),\n takeSnapshot: createApiMethod<() => Promise<string>>('takeSnapshot'),\n fitToCoordinates: async (points: LatLngPoint[], options?: FitToCoordinatesOptions) => {\n try {\n const normalized = points.map((point) => normalizeLatLng(point));\n if (normalized.length === 0) {\n return;\n }\n\n const currentCamera = await callNativeMethod<() => Promise<CameraPosition>>('getCameraPosition');\n if (normalized.length === 1) {\n await callNativeMethod<(cameraPosition: CameraUpdate, animationDuration: number) => Promise<void>>(\n 'moveCamera',\n {\n target: normalized[0],\n zoom: options?.singlePointZoom ?? currentCamera.zoom ?? 16,\n bearing: options?.preserveBearing === false ? options?.bearing : currentCamera.bearing ?? options?.bearing,\n tilt: options?.preserveTilt === false ? options?.tilt : currentCamera.tilt ?? options?.tilt,\n },\n options?.duration ?? 0\n );\n return;\n }\n\n const latitudes = normalized.map((point) => point.latitude);\n const longitudes = normalized.map((point) => point.longitude);\n const paddingFactor = options?.paddingFactor ?? 1.2;\n const north = Math.max(...latitudes);\n const south = Math.min(...latitudes);\n const east = Math.max(...longitudes);\n const west = Math.min(...longitudes);\n\n await callNativeMethod<(cameraPosition: CameraUpdate, animationDuration: number) => Promise<void>>(\n 'moveCamera',\n {\n target: {\n latitude: (north + south) / 2,\n longitude: (east + west) / 2,\n },\n zoom: estimateZoom((north - south) * paddingFactor, (east - west) * paddingFactor, options),\n bearing: options?.preserveBearing === false ? options?.bearing : currentCamera.bearing ?? options?.bearing,\n tilt: options?.preserveTilt === false ? options?.tilt : currentCamera.tilt ?? options?.tilt,\n },\n options?.duration ?? 0\n );\n } catch (error) {\n throw ErrorHandler.wrapNativeError(error, 'fitToCoordinates');\n }\n },\n }), [callNativeMethod, createApiMethod]);\n\n /**\n * 将传入的apiRef赋值给internalRef.current\n * 用于在组件内部保存对地图API实例的引用\n */\n React.useEffect(() => {\n internalRef.current = apiRef;\n }, [apiRef]);\n\n /**\n * 获取当前地图实例的API引用\n * @returns 返回地图API的引用对象,可用于调用地图相关方法\n */\n React.useImperativeHandle(ref, () => apiRef, [apiRef]);\n\n // 分离 children:区分原生覆盖物和普通 UI 组件\n const { children, style, ...otherProps } = props;\n const overlays: React.ReactNode[] = [];\n const uiControls: React.ReactNode[] = [];\n\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child) && (child.type === MapUI || (child.type as { isMapUI?: boolean })?.isMapUI)) {\n uiControls.push(child);\n } else {\n overlays.push(child);\n }\n });\n\n return (\n <MapContext.Provider value={apiRef}>\n <View style={[{ flex: 1, position: 'relative', overflow: 'hidden' ,}, style]}>\n <NativeView\n ref={nativeRef}\n style={StyleSheet.absoluteFill}\n {...otherProps}\n >\n {overlays}\n </NativeView>\n {uiControls}\n </View>\n </MapContext.Provider>\n );\n});\n\nExpoGaodeMapView.displayName = 'ExpoGaodeMapView';\n\nexport default ExpoGaodeMapView;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cluster.d.ts","sourceRoot":"","sources":["../../../../src/map/components/overlays/Cluster.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD;;;;;GAKG;AACH,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,qBAGnC;;
|
|
1
|
+
{"version":3,"file":"Cluster.d.ts","sourceRoot":"","sources":["../../../../src/map/components/overlays/Cluster.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD;;;;;GAKG;AACH,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,qBAGnC;;AAoDD,wBAAkD"}
|
|
@@ -24,10 +24,22 @@ function arePropsEqual(prevProps, nextProps) {
|
|
|
24
24
|
if (prevProps.radius !== nextProps.radius) {
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
27
|
+
// 比较基础图标
|
|
28
|
+
if (prevProps.icon !== nextProps.icon) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
27
31
|
// 比较 minClusterSize
|
|
28
32
|
if (prevProps.minClusterSize !== nextProps.minClusterSize) {
|
|
29
33
|
return false;
|
|
30
34
|
}
|
|
35
|
+
// 比较聚合样式
|
|
36
|
+
if (prevProps.clusterStyle !== nextProps.clusterStyle) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
// 比较聚合文本样式
|
|
40
|
+
if (prevProps.clusterTextStyle !== nextProps.clusterTextStyle) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
31
43
|
// 比较 clusterBuckets
|
|
32
44
|
if (prevProps.clusterBuckets !== nextProps.clusterBuckets) {
|
|
33
45
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cluster.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Cluster.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAEhF,MAAM,gBAAgB,GAAG,2BAA2B,CAAe,aAAa,CAAC,CAAC;AAElF;;;;;GAKG;AACH,SAAS,OAAO,CAAC,KAAmB;IAClC,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,gBAAgB,EAAE,EAAE,EAAE,CAAC,CAAC;IAClE,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CAAC,SAAuB,EAAE,SAAuB;IACrE,uBAAuB;IACvB,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,YAAY;IACZ,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oBAAoB;IACpB,IAAI,SAAS,CAAC,cAAc,KAAK,SAAS,CAAC,cAAc,EAAE,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oBAAoB;IACpB,IAAI,SAAS,CAAC,cAAc,KAAK,SAAS,CAAC,cAAc,EAAE,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,uBAAuB;IACvB,IAAI,SAAS,CAAC,cAAc,KAAK,SAAS,CAAC,cAAc,EAAE,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,eAAe;IACf,OAAO,IAAI,CAAC;AACd,CAAC;AAED,WAAW;AACX,eAAe,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport type { ClusterProps } from '../../types';\nimport { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';\n\nconst getNativeCluster = createLazyNativeViewManager<ClusterProps>('ClusterView');\n\n/**\n * 高德地图点聚合组件\n *\n * @param props 点聚合组件的属性配置\n * @returns 渲染原生点聚合组件\n */\nfunction Cluster(props: ClusterProps) {\n const NativeCluster = React.useMemo(() => getNativeCluster(), []);\n return <NativeCluster {...props} />;\n}\n\n/**\n * 🔑 性能优化:浅比较关键属性\n * 只检查最常变化的属性,避免深度比较开销\n */\nfunction arePropsEqual(prevProps: ClusterProps, nextProps: ClusterProps): boolean {\n // 比较 points 数组引用(最常变化)\n if (prevProps.points !== nextProps.points) {\n return false;\n }\n \n // 比较 radius\n if (prevProps.radius !== nextProps.radius) {\n return false;\n }\n \n // 比较 minClusterSize\n if (prevProps.minClusterSize !== nextProps.minClusterSize) {\n return false;\n }\n \n // 比较 clusterBuckets\n if (prevProps.clusterBuckets !== nextProps.clusterBuckets) {\n return false;\n }\n \n // 比较 onClusterPress 回调\n if (prevProps.onClusterPress !== nextProps.onClusterPress) {\n return false;\n }\n \n // 其他属性相同,不重新渲染\n return true;\n}\n\n// 导出优化后的组件\nexport default React.memo(Cluster, arePropsEqual);\n"]}
|
|
1
|
+
{"version":3,"file":"Cluster.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Cluster.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAEhF,MAAM,gBAAgB,GAAG,2BAA2B,CAAe,aAAa,CAAC,CAAC;AAElF;;;;;GAKG;AACH,SAAS,OAAO,CAAC,KAAmB;IAClC,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,gBAAgB,EAAE,EAAE,EAAE,CAAC,CAAC;IAClE,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CAAC,SAAuB,EAAE,SAAuB;IACrE,uBAAuB;IACvB,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,YAAY;IACZ,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS;IACT,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oBAAoB;IACpB,IAAI,SAAS,CAAC,cAAc,KAAK,SAAS,CAAC,cAAc,EAAE,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS;IACT,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,CAAC,YAAY,EAAE,CAAC;QACtD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,WAAW;IACX,IAAI,SAAS,CAAC,gBAAgB,KAAK,SAAS,CAAC,gBAAgB,EAAE,CAAC;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oBAAoB;IACpB,IAAI,SAAS,CAAC,cAAc,KAAK,SAAS,CAAC,cAAc,EAAE,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,uBAAuB;IACvB,IAAI,SAAS,CAAC,cAAc,KAAK,SAAS,CAAC,cAAc,EAAE,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,eAAe;IACf,OAAO,IAAI,CAAC;AACd,CAAC;AAED,WAAW;AACX,eAAe,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport type { ClusterProps } from '../../types';\nimport { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';\n\nconst getNativeCluster = createLazyNativeViewManager<ClusterProps>('ClusterView');\n\n/**\n * 高德地图点聚合组件\n *\n * @param props 点聚合组件的属性配置\n * @returns 渲染原生点聚合组件\n */\nfunction Cluster(props: ClusterProps) {\n const NativeCluster = React.useMemo(() => getNativeCluster(), []);\n return <NativeCluster {...props} />;\n}\n\n/**\n * 🔑 性能优化:浅比较关键属性\n * 只检查最常变化的属性,避免深度比较开销\n */\nfunction arePropsEqual(prevProps: ClusterProps, nextProps: ClusterProps): boolean {\n // 比较 points 数组引用(最常变化)\n if (prevProps.points !== nextProps.points) {\n return false;\n }\n \n // 比较 radius\n if (prevProps.radius !== nextProps.radius) {\n return false;\n }\n\n // 比较基础图标\n if (prevProps.icon !== nextProps.icon) {\n return false;\n }\n \n // 比较 minClusterSize\n if (prevProps.minClusterSize !== nextProps.minClusterSize) {\n return false;\n }\n\n // 比较聚合样式\n if (prevProps.clusterStyle !== nextProps.clusterStyle) {\n return false;\n }\n\n // 比较聚合文本样式\n if (prevProps.clusterTextStyle !== nextProps.clusterTextStyle) {\n return false;\n }\n \n // 比较 clusterBuckets\n if (prevProps.clusterBuckets !== nextProps.clusterBuckets) {\n return false;\n }\n \n // 比较 onClusterPress 回调\n if (prevProps.onClusterPress !== nextProps.onClusterPress) {\n return false;\n }\n \n // 其他属性相同,不重新渲染\n return true;\n}\n\n// 导出优化后的组件\nexport default React.memo(Cluster, arePropsEqual);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Marker.d.ts","sourceRoot":"","sources":["../../../../src/map/components/overlays/Marker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Marker.d.ts","sourceRoot":"","sources":["../../../../src/map/components/overlays/Marker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA4C/C;;;;;;;;;GASG;AACH,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,qBAmFjC;;AAsDD,wBAAiD"}
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Platform, StyleSheet, View } from 'react-native';
|
|
2
3
|
import { normalizeLatLng, normalizeLatLngList } from '../../utils/GeoUtils';
|
|
3
4
|
import { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';
|
|
4
5
|
const getNativeMarkerView = createLazyNativeViewManager('MarkerView');
|
|
6
|
+
const AUTO_SIZE_FALLBACK = { width: 0, height: 0 };
|
|
7
|
+
function areSmoothMovePathsEqual(prevPath, nextPath) {
|
|
8
|
+
if (prevPath === nextPath) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (!prevPath || !nextPath) {
|
|
12
|
+
return prevPath === nextPath;
|
|
13
|
+
}
|
|
14
|
+
if (prevPath.length !== nextPath.length) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
for (let index = 0; index < prevPath.length; index += 1) {
|
|
18
|
+
const prevPoint = normalizeLatLng(prevPath[index]);
|
|
19
|
+
const nextPoint = normalizeLatLng(nextPath[index]);
|
|
20
|
+
if (prevPoint.latitude !== nextPoint.latitude ||
|
|
21
|
+
prevPoint.longitude !== nextPoint.longitude) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
5
27
|
/**
|
|
6
28
|
* Marker 组件 - 完全声明式 API
|
|
7
29
|
*
|
|
@@ -14,22 +36,49 @@ const getNativeMarkerView = createLazyNativeViewManager('MarkerView');
|
|
|
14
36
|
*/
|
|
15
37
|
function Marker(props) {
|
|
16
38
|
const NativeMarkerView = React.useMemo(() => getNativeMarkerView(), []);
|
|
39
|
+
const [measuredSize, setMeasuredSize] = React.useState(AUTO_SIZE_FALLBACK);
|
|
17
40
|
// 从 props 中排除 position 属性,避免传递到原生层
|
|
18
|
-
const { position, customViewWidth, customViewHeight, iconWidth, iconHeight, children, smoothMovePath, ...restProps } = props;
|
|
41
|
+
const { position, customViewWidth, customViewHeight, iconWidth, iconHeight, children, smoothMovePath, cacheKey, ...restProps } = props;
|
|
19
42
|
// 归一化坐标处理
|
|
20
43
|
const normalizedPosition = normalizeLatLng(position);
|
|
21
44
|
const normalizedSmoothMovePath = smoothMovePath ? normalizeLatLngList(smoothMovePath) : undefined;
|
|
22
45
|
// 根据是否有 children 来决定使用哪个尺寸属性
|
|
23
46
|
const hasChildren = !!children;
|
|
47
|
+
const shouldWrapChildrenForMeasurement = hasChildren;
|
|
48
|
+
const shouldUseAutoMeasuredSize = Platform.OS === 'ios';
|
|
49
|
+
const resolvedCustomViewWidth = customViewWidth && customViewWidth > 0
|
|
50
|
+
? customViewWidth
|
|
51
|
+
: (shouldUseAutoMeasuredSize ? measuredSize.width : 0);
|
|
52
|
+
const resolvedCustomViewHeight = customViewHeight && customViewHeight > 0
|
|
53
|
+
? customViewHeight
|
|
54
|
+
: (shouldUseAutoMeasuredSize ? measuredSize.height : 0);
|
|
55
|
+
const handleAutoMeasure = (event) => {
|
|
56
|
+
const nextWidth = customViewWidth && customViewWidth > 0
|
|
57
|
+
? customViewWidth
|
|
58
|
+
: Math.ceil(event.nativeEvent.layout.width);
|
|
59
|
+
const nextHeight = customViewHeight && customViewHeight > 0
|
|
60
|
+
? customViewHeight
|
|
61
|
+
: Math.ceil(event.nativeEvent.layout.height);
|
|
62
|
+
if (nextWidth === measuredSize.width && nextHeight === measuredSize.height) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
setMeasuredSize({
|
|
66
|
+
width: nextWidth,
|
|
67
|
+
height: nextHeight,
|
|
68
|
+
});
|
|
69
|
+
};
|
|
24
70
|
// 智能尺寸计算
|
|
25
71
|
const finalIconWidth = hasChildren
|
|
26
|
-
?
|
|
72
|
+
? resolvedCustomViewWidth
|
|
27
73
|
: (iconWidth && iconWidth > 0 ? iconWidth : 40);
|
|
28
74
|
const finalIconHeight = hasChildren
|
|
29
|
-
?
|
|
75
|
+
? resolvedCustomViewHeight
|
|
30
76
|
: (iconHeight && iconHeight > 0 ? iconHeight : 40);
|
|
31
|
-
|
|
32
|
-
|
|
77
|
+
const optionalNativeProps = cacheKey != null ? { cacheKey } : undefined;
|
|
78
|
+
return (<NativeMarkerView latitude={normalizedPosition.latitude} longitude={normalizedPosition.longitude} iconWidth={finalIconWidth} iconHeight={finalIconHeight} customViewWidth={finalIconWidth} customViewHeight={finalIconHeight} smoothMovePath={normalizedSmoothMovePath} {...optionalNativeProps} {...restProps}>
|
|
79
|
+
{hasChildren && shouldWrapChildrenForMeasurement ? (<View collapsable={false} onLayout={Platform.OS === 'ios' ? handleAutoMeasure : undefined} style={styles.measureContainer}>
|
|
80
|
+
{children}
|
|
81
|
+
</View>) : children}
|
|
33
82
|
</NativeMarkerView>);
|
|
34
83
|
}
|
|
35
84
|
/**
|
|
@@ -52,8 +101,16 @@ function arePropsEqual(prevProps, nextProps) {
|
|
|
52
101
|
if (prevProps.children !== nextProps.children) {
|
|
53
102
|
return false;
|
|
54
103
|
}
|
|
104
|
+
// 比较自定义内容尺寸和图标尺寸
|
|
105
|
+
if (prevProps.customViewWidth !== nextProps.customViewWidth ||
|
|
106
|
+
prevProps.customViewHeight !== nextProps.customViewHeight ||
|
|
107
|
+
prevProps.icon !== nextProps.icon ||
|
|
108
|
+
prevProps.iconWidth !== nextProps.iconWidth ||
|
|
109
|
+
prevProps.iconHeight !== nextProps.iconHeight) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
55
112
|
// 比较 smoothMovePath (平滑移动路径)
|
|
56
|
-
if (
|
|
113
|
+
if (!areSmoothMovePathsEqual(prevProps.smoothMovePath, nextProps.smoothMovePath)) {
|
|
57
114
|
return false;
|
|
58
115
|
}
|
|
59
116
|
// 比较 smoothMoveDuration (平滑移动时长)
|
|
@@ -65,4 +122,11 @@ function arePropsEqual(prevProps, nextProps) {
|
|
|
65
122
|
}
|
|
66
123
|
// 导出优化后的组件
|
|
67
124
|
export default React.memo(Marker, arePropsEqual);
|
|
125
|
+
const styles = StyleSheet.create({
|
|
126
|
+
measureContainer: {
|
|
127
|
+
alignSelf: 'flex-start',
|
|
128
|
+
alignItems: 'flex-start',
|
|
129
|
+
flexShrink: 0,
|
|
130
|
+
},
|
|
131
|
+
});
|
|
68
132
|
//# sourceMappingURL=Marker.js.map
|
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AI,CAAC,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;QAC1F,OAAO,KAAK,CAAC;IACf,CAAC;IAED,iCAAiC;IACjC,IAAI,SAAS,CAAC,kBAAkB,KAAK,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,eAAe;IACf,OAAO,IAAI,CAAC;AACd,CAAC;AAED,WAAW;AACX,eAAe,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport type { MarkerProps } from '../../types';\nimport { normalizeLatLng, normalizeLatLngList } from '../../utils/GeoUtils';\nimport { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';\n\ntype NativeMarkerViewProps = Omit<MarkerProps, 'position'> & {\n latitude: number;\n longitude: number;\n};\n\nconst getNativeMarkerView = createLazyNativeViewManager<NativeMarkerViewProps>('MarkerView');\n\n/**\n * Marker 组件 - 完全声明式 API\n *\n * 支持:\n * - 自定义图标(icon)\n * - 自定义内容(children)- 自动测量尺寸\n * - 大头针样式(pinColor)\n * - 拖拽功能\n * - 所有事件回调\n */\nfunction Marker(props: MarkerProps) {\n const NativeMarkerView = React.useMemo(() => getNativeMarkerView(), []);\n // 从 props 中排除 position 属性,避免传递到原生层\n const { position, customViewWidth, customViewHeight, iconWidth, iconHeight, children, smoothMovePath, ...restProps } = props;\n \n // 归一化坐标处理\n const normalizedPosition = normalizeLatLng(position);\n const normalizedSmoothMovePath = smoothMovePath ? normalizeLatLngList(smoothMovePath) : undefined;\n\n // 根据是否有 children 来决定使用哪个尺寸属性\n const hasChildren = !!children;\n \n // 智能尺寸计算\n const finalIconWidth = hasChildren\n ? (customViewWidth && customViewWidth > 0 ? customViewWidth : 0)\n : (iconWidth && iconWidth > 0 ? iconWidth : 40);\n \n const finalIconHeight = hasChildren\n ? (customViewHeight && customViewHeight > 0 ? customViewHeight : 0)\n : (iconHeight && iconHeight > 0 ? iconHeight : 40);\n \n return (\n <NativeMarkerView\n latitude={normalizedPosition.latitude}\n longitude={normalizedPosition.longitude}\n iconWidth={finalIconWidth}\n iconHeight={finalIconHeight}\n customViewWidth={finalIconWidth}\n customViewHeight={finalIconHeight}\n smoothMovePath={normalizedSmoothMovePath}\n {...restProps}\n >\n {children}\n </NativeMarkerView>\n );\n}\n\n/**\n * 🔑 性能优化:极简比较函数\n * 只检查最常变化的关键属性,减少 JS 线程开销\n */\nfunction arePropsEqual(prevProps: MarkerProps, nextProps: MarkerProps): boolean {\n // 快速路径:比较 position (最常变化)\n const prevPos = normalizeLatLng(prevProps.position);\n const nextPos = normalizeLatLng(nextProps.position);\n\n if (\n prevPos.latitude !== nextPos.latitude ||\n prevPos.longitude !== nextPos.longitude\n ) {\n return false;\n }\n \n // 比较 cacheKey (如果提供了 cacheKey,其他属性理论上不会变)\n if (prevProps.cacheKey !== nextProps.cacheKey) {\n return false;\n }\n \n // 比较 children (如果有 children)\n if (prevProps.children !== nextProps.children) {\n return false;\n }\n \n // 比较 smoothMovePath (平滑移动路径)\n if (JSON.stringify(prevProps.smoothMovePath) !== JSON.stringify(nextProps.smoothMovePath)) {\n return false;\n }\n \n // 比较 smoothMoveDuration (平滑移动时长)\n if (prevProps.smoothMoveDuration !== nextProps.smoothMoveDuration) {\n return false;\n }\n \n // 其他属性相同,不重新渲染\n return true;\n}\n\n// 导出优化后的组件\nexport default React.memo(Marker, arePropsEqual);\n"]}
|
|
1
|
+
{"version":3,"file":"Marker.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Marker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC5E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,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,cAAc,EAAE,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;QACjF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,iCAAiC;IACjC,IAAI,SAAS,CAAC,kBAAkB,KAAK,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,eAAe;IACf,OAAO,IAAI,CAAC;AACd,CAAC;AAED,WAAW;AACX,eAAe,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAEjD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,gBAAgB,EAAE;QAChB,SAAS,EAAE,YAAY;QACvB,UAAU,EAAE,YAAY;QACxB,UAAU,EAAE,CAAC;KACd;CACF,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { Platform, StyleSheet, View } from 'react-native';\nimport type { MarkerProps } from '../../types';\nimport { normalizeLatLng, normalizeLatLngList } from '../../utils/GeoUtils';\nimport { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';\n\ntype NativeMarkerViewProps = Omit<MarkerProps, 'position'> & {\n latitude: number;\n longitude: number;\n};\n\nconst getNativeMarkerView = createLazyNativeViewManager<NativeMarkerViewProps>('MarkerView');\n\nconst AUTO_SIZE_FALLBACK = { width: 0, height: 0 };\n\nfunction areSmoothMovePathsEqual(\n prevPath: MarkerProps['smoothMovePath'],\n nextPath: MarkerProps['smoothMovePath']\n): boolean {\n if (prevPath === nextPath) {\n return true;\n }\n\n if (!prevPath || !nextPath) {\n return prevPath === nextPath;\n }\n\n if (prevPath.length !== nextPath.length) {\n return false;\n }\n\n for (let index = 0; index < prevPath.length; index += 1) {\n const prevPoint = normalizeLatLng(prevPath[index]);\n const nextPoint = normalizeLatLng(nextPath[index]);\n\n if (\n prevPoint.latitude !== nextPoint.latitude ||\n prevPoint.longitude !== nextPoint.longitude\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Marker 组件 - 完全声明式 API\n *\n * 支持:\n * - 自定义图标(icon)\n * - 自定义内容(children)- 自动测量尺寸\n * - 大头针样式(pinColor)\n * - 拖拽功能\n * - 所有事件回调\n */\nfunction Marker(props: MarkerProps) {\n const NativeMarkerView = React.useMemo(() => getNativeMarkerView(), []);\n const [measuredSize, setMeasuredSize] = React.useState(AUTO_SIZE_FALLBACK);\n // 从 props 中排除 position 属性,避免传递到原生层\n const {\n position,\n customViewWidth,\n customViewHeight,\n iconWidth,\n iconHeight,\n children,\n smoothMovePath,\n cacheKey,\n ...restProps\n } = props;\n \n // 归一化坐标处理\n const normalizedPosition = normalizeLatLng(position);\n const normalizedSmoothMovePath = smoothMovePath ? normalizeLatLngList(smoothMovePath) : undefined;\n\n // 根据是否有 children 来决定使用哪个尺寸属性\n const hasChildren = !!children;\n const shouldWrapChildrenForMeasurement = hasChildren;\n const shouldUseAutoMeasuredSize = Platform.OS === 'ios';\n const resolvedCustomViewWidth = customViewWidth && customViewWidth > 0\n ? customViewWidth\n : (shouldUseAutoMeasuredSize ? measuredSize.width : 0);\n const resolvedCustomViewHeight = customViewHeight && customViewHeight > 0\n ? customViewHeight\n : (shouldUseAutoMeasuredSize ? measuredSize.height : 0);\n\n const handleAutoMeasure = (event: LayoutChangeEvent) => {\n const nextWidth = customViewWidth && customViewWidth > 0\n ? customViewWidth\n : Math.ceil(event.nativeEvent.layout.width);\n const nextHeight = customViewHeight && customViewHeight > 0\n ? customViewHeight\n : Math.ceil(event.nativeEvent.layout.height);\n\n if (nextWidth === measuredSize.width && nextHeight === measuredSize.height) {\n return;\n }\n\n setMeasuredSize({\n width: nextWidth,\n height: nextHeight,\n });\n };\n \n // 智能尺寸计算\n const finalIconWidth = hasChildren\n ? resolvedCustomViewWidth\n : (iconWidth && iconWidth > 0 ? iconWidth : 40);\n \n const finalIconHeight = hasChildren\n ? resolvedCustomViewHeight\n : (iconHeight && iconHeight > 0 ? iconHeight : 40);\n\n const optionalNativeProps = cacheKey != null ? { cacheKey } : undefined;\n \n return (\n <NativeMarkerView\n latitude={normalizedPosition.latitude}\n longitude={normalizedPosition.longitude}\n iconWidth={finalIconWidth}\n iconHeight={finalIconHeight}\n customViewWidth={finalIconWidth}\n customViewHeight={finalIconHeight}\n smoothMovePath={normalizedSmoothMovePath}\n {...optionalNativeProps}\n {...restProps}\n >\n {hasChildren && shouldWrapChildrenForMeasurement ? (\n <View\n collapsable={false}\n onLayout={Platform.OS === 'ios' ? handleAutoMeasure : undefined}\n style={styles.measureContainer}\n >\n {children}\n </View>\n ) : children}\n </NativeMarkerView>\n );\n}\n\n/**\n * 🔑 性能优化:极简比较函数\n * 只检查最常变化的关键属性,减少 JS 线程开销\n */\nfunction arePropsEqual(prevProps: MarkerProps, nextProps: MarkerProps): boolean {\n // 快速路径:比较 position (最常变化)\n const prevPos = normalizeLatLng(prevProps.position);\n const nextPos = normalizeLatLng(nextProps.position);\n\n if (\n prevPos.latitude !== nextPos.latitude ||\n prevPos.longitude !== nextPos.longitude\n ) {\n return false;\n }\n \n // 比较 cacheKey (如果提供了 cacheKey,其他属性理论上不会变)\n if (prevProps.cacheKey !== nextProps.cacheKey) {\n return false;\n }\n \n // 比较 children (如果有 children)\n if (prevProps.children !== nextProps.children) {\n return false;\n }\n\n // 比较自定义内容尺寸和图标尺寸\n if (\n prevProps.customViewWidth !== nextProps.customViewWidth ||\n prevProps.customViewHeight !== nextProps.customViewHeight ||\n prevProps.icon !== nextProps.icon ||\n prevProps.iconWidth !== nextProps.iconWidth ||\n prevProps.iconHeight !== nextProps.iconHeight\n ) {\n return false;\n }\n \n // 比较 smoothMovePath (平滑移动路径)\n if (!areSmoothMovePathsEqual(prevProps.smoothMovePath, nextProps.smoothMovePath)) {\n return false;\n }\n \n // 比较 smoothMoveDuration (平滑移动时长)\n if (prevProps.smoothMoveDuration !== nextProps.smoothMoveDuration) {\n return false;\n }\n \n // 其他属性相同,不重新渲染\n return true;\n}\n\n// 导出优化后的组件\nexport default React.memo(Marker, arePropsEqual);\n\nconst styles = StyleSheet.create({\n measureContainer: {\n alignSelf: 'flex-start',\n alignItems: 'flex-start',\n flexShrink: 0,\n },\n});\n"]}
|
|
@@ -139,6 +139,30 @@ export interface CameraPosition {
|
|
|
139
139
|
*/
|
|
140
140
|
tilt?: number;
|
|
141
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* 地图相机更新参数
|
|
144
|
+
*
|
|
145
|
+
* 与 `CameraPosition` 不同,这个类型用于描述“局部更新”:
|
|
146
|
+
* 你可以只传 `zoom`、只传 `target`,或组合传入需要变更的字段。
|
|
147
|
+
*/
|
|
148
|
+
export interface CameraUpdate {
|
|
149
|
+
/**
|
|
150
|
+
* 中心坐标
|
|
151
|
+
*/
|
|
152
|
+
target?: LatLng;
|
|
153
|
+
/**
|
|
154
|
+
* 缩放级别(3-20)
|
|
155
|
+
*/
|
|
156
|
+
zoom?: number;
|
|
157
|
+
/**
|
|
158
|
+
* 朝向、旋转角度(0-360度)
|
|
159
|
+
*/
|
|
160
|
+
bearing?: number;
|
|
161
|
+
/**
|
|
162
|
+
* 倾斜角度(0-60度)
|
|
163
|
+
*/
|
|
164
|
+
tilt?: number;
|
|
165
|
+
}
|
|
142
166
|
/**
|
|
143
167
|
* 地图类型
|
|
144
168
|
*/
|
|
@@ -146,24 +170,24 @@ export declare enum MapType {
|
|
|
146
170
|
/**
|
|
147
171
|
* 标准地图
|
|
148
172
|
*/
|
|
149
|
-
Standard =
|
|
173
|
+
Standard = 1,
|
|
150
174
|
/**
|
|
151
175
|
* 卫星地图
|
|
152
176
|
*/
|
|
153
|
-
Satellite =
|
|
177
|
+
Satellite = 2,
|
|
154
178
|
/**
|
|
155
179
|
* 夜间地图
|
|
156
180
|
*/
|
|
157
|
-
Night =
|
|
181
|
+
Night = 3,
|
|
158
182
|
/**
|
|
159
183
|
* 导航地图
|
|
160
184
|
*/
|
|
161
|
-
Navi =
|
|
185
|
+
Navi = 4,
|
|
162
186
|
/**
|
|
163
187
|
* 公交地图
|
|
164
188
|
* @platform android
|
|
165
189
|
*/
|
|
166
|
-
Bus =
|
|
190
|
+
Bus = 5
|
|
167
191
|
}
|
|
168
192
|
/**
|
|
169
193
|
* 颜色值类型
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.types.d.ts","sourceRoot":"","sources":["../../../src/map/types/common.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,sBAAsB;IACtB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mBAAmB;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,4BAA4B;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D,oBAAoB;IACpB,OAAO,EAAE,OAAO,CAAC;IAGjB,qBAAqB;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB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AAW,YAAY;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,oBAAY,OAAO;IACjB;;OAEG;IACH,QAAQ,IAAI;IAEZ;;OAEG;IACH,SAAS,IAAI;IAEb;;OAEG;IACH,KAAK,IAAI;IAET;;OAEG;IACH,IAAI,IAAI;IAER;;;OAGG;IACH,GAAG,IAAI;CACR;AAED;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC"}
|
|
@@ -6,23 +6,23 @@ export var MapType;
|
|
|
6
6
|
/**
|
|
7
7
|
* 标准地图
|
|
8
8
|
*/
|
|
9
|
-
MapType[MapType["Standard"] =
|
|
9
|
+
MapType[MapType["Standard"] = 1] = "Standard";
|
|
10
10
|
/**
|
|
11
11
|
* 卫星地图
|
|
12
12
|
*/
|
|
13
|
-
MapType[MapType["Satellite"] =
|
|
13
|
+
MapType[MapType["Satellite"] = 2] = "Satellite";
|
|
14
14
|
/**
|
|
15
15
|
* 夜间地图
|
|
16
16
|
*/
|
|
17
|
-
MapType[MapType["Night"] =
|
|
17
|
+
MapType[MapType["Night"] = 3] = "Night";
|
|
18
18
|
/**
|
|
19
19
|
* 导航地图
|
|
20
20
|
*/
|
|
21
|
-
MapType[MapType["Navi"] =
|
|
21
|
+
MapType[MapType["Navi"] = 4] = "Navi";
|
|
22
22
|
/**
|
|
23
23
|
* 公交地图
|
|
24
24
|
* @platform android
|
|
25
25
|
*/
|
|
26
|
-
MapType[MapType["Bus"] =
|
|
26
|
+
MapType[MapType["Bus"] = 5] = "Bus";
|
|
27
27
|
})(MapType || (MapType = {}));
|
|
28
28
|
//# sourceMappingURL=common.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.types.js","sourceRoot":"","sources":["../../../src/map/types/common.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.types.js","sourceRoot":"","sources":["../../../src/map/types/common.types.ts"],"names":[],"mappings":"AA+LA;;GAEG;AACH,MAAM,CAAN,IAAY,OA0BX;AA1BD,WAAY,OAAO;IACjB;;OAEG;IACH,6CAAY,CAAA;IAEZ;;OAEG;IACH,+CAAa,CAAA;IAEb;;OAEG;IACH,uCAAS,CAAA;IAET;;OAEG;IACH,qCAAQ,CAAA;IAER;;;OAGG;IACH,mCAAO,CAAA;AACT,CAAC,EA1BW,OAAO,KAAP,OAAO,QA0BlB","sourcesContent":["/**\n * 高德地图通用类型定义\n * 基于 Expo Modules API\n */\nimport { PermissionResponse } from 'expo-modules-core';\n\n/**\n * SDK 配置参数\n */\nexport interface SDKConfig {\n /** Android 平台的高德地图 API Key */\n androidKey?: string;\n /** iOS 平台的高德地图 API Key */\n iosKey?: string;\n /** web api key 如果要使用expo-gaode-map-web-api相关的功能,需要配置web api key*/\n webKey?: string;\n}\n\n/**\n * 隐私同意配置\n * 推荐优先使用该配置对象一次性完成隐私状态同步\n */\nexport interface PrivacyConfig {\n /** 是否已经向用户展示隐私弹窗或隐私说明 */\n hasShow: boolean;\n /** 展示内容中是否包含隐私政策条款 */\n hasContainsPrivacy: boolean;\n /** 用户是否已经同意隐私政策 */\n hasAgree: boolean;\n /** 可选的隐私协议版本号;变更后会要求重新同意 */\n privacyVersion?: string;\n}\n\n/**\n * 隐私政策状态\n */\nexport interface PrivacyStatus {\n hasShow: boolean;\n hasContainsPrivacy: boolean;\n hasAgree: boolean;\n isReady: boolean;\n privacyVersion?: string | null;\n agreedPrivacyVersion?: string | null;\n restoredFromStorage?: boolean;\n}\n\n/**\n * 权限状态(增强版,支持 Android 14+ 和 iOS 17+)\n */\nexport interface PermissionStatus extends PermissionResponse{\n /** 是否已授权(前台位置权限) */\n granted: boolean;\n \n // Android 专用字段\n /** Android 精确位置权限 */\n fineLocation?: boolean;\n /** Android 粗略位置权限 */\n coarseLocation?: boolean;\n /** Android 后台位置权限(Android 10+) */\n backgroundLocation?: boolean;\n /** 是否应显示权限说明(Android) */\n shouldShowRationale?: boolean;\n /** 权限是否被永久拒绝(Android) */\n isPermanentlyDenied?: boolean;\n /** 是否为 Android 14+(Android) */\n isAndroid14Plus?: boolean;\n \n // 其他字段\n /** 额外的消息说明 */\n message?: string;\n}\n\n/**\n * 点坐标(屏幕坐标)\n */\nexport interface Point {\n x: number;\n y: number;\n}\n\n/**\n * 地理坐标\n */\nexport interface LatLng {\n /**\n * 纬度\n */\n latitude: number;\n\n /**\n * 经度\n */\n longitude: number;\n}\n\n/**\n * 坐标点类型\n * 支持对象格式 { latitude, longitude }\n * 或数组格式 [longitude, latitude] (GeoJSON 标准)\n * 注意:GeoJSON 标准允许数组包含更多元素(如海拔),但本组件只使用前两个\n */\nexport type LatLngPoint = LatLng | [number, number] | number[];\n\n/**\n * 地图标注点(POI)\n */\nexport interface MapPoi {\n /**\n * 标注点 ID\n */\n id: string;\n\n /**\n * 标注点名称\n */\n name: string;\n\n /**\n * 标注点坐标\n */\n position: LatLng;\n}\n\n/**\n * 矩形坐标边界\n */\nexport interface LatLngBounds {\n /**\n * 西南坐标\n */\n southwest: LatLng;\n\n /**\n * 东北坐标\n */\n northeast: LatLng;\n}\n\n/**\n * 地图相机位置\n */\nexport interface CameraPosition {\n /**\n * 中心坐标\n */\n target?: LatLng;\n\n /**\n * 缩放级别(3-20)\n */\n zoom?: number;\n\n /**\n * 朝向、旋转角度(0-360度)\n */\n bearing?: number;\n\n /**\n * 倾斜角度(0-60度)\n */\n tilt?: number;\n}\n\n/**\n * 地图相机更新参数\n *\n * 与 `CameraPosition` 不同,这个类型用于描述“局部更新”:\n * 你可以只传 `zoom`、只传 `target`,或组合传入需要变更的字段。\n */\nexport interface CameraUpdate {\n /**\n * 中心坐标\n */\n target?: LatLng;\n\n /**\n * 缩放级别(3-20)\n */\n zoom?: number;\n\n /**\n * 朝向、旋转角度(0-360度)\n */\n bearing?: number;\n\n /**\n * 倾斜角度(0-60度)\n */\n tilt?: number;\n}\n\n/**\n * 地图类型\n */\nexport enum MapType {\n /**\n * 标准地图\n */\n Standard = 1,\n\n /**\n * 卫星地图\n */\n Satellite = 2,\n\n /**\n * 夜间地图\n */\n Night = 3,\n\n /**\n * 导航地图\n */\n Navi = 4,\n\n /**\n * 公交地图\n * @platform android\n */\n Bus = 5,\n}\n\n/**\n * 颜色值类型\n * 支持:\n * - 十六进制字符串: '#AARRGGBB' 或 '#RRGGBB'\n * - 数字格式: 0xAARRGGBB (用于 Android)\n */\nexport type ColorValue = string | number;\n"]}
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* 高德地图 Expo Module 类型定义统一导出
|
|
3
3
|
* 基于 Expo Modules API 重新设计
|
|
4
4
|
*/
|
|
5
|
-
export type { Point, LatLng, LatLngPoint, MapPoi, LatLngBounds, CameraPosition, ColorValue, SDKConfig, PermissionStatus, } from './common.types';
|
|
5
|
+
export type { Point, LatLng, LatLngPoint, MapPoi, LatLngBounds, CameraPosition, CameraUpdate, ColorValue, SDKConfig, PermissionStatus, } from './common.types';
|
|
6
6
|
export { MapType } from './common.types';
|
|
7
7
|
export type { LocationEvent, CameraEvent, MapViewProps, MapViewMethods, MapViewRef, ExpoGaodeMapModuleEvents, } from './map-view.types';
|
|
8
8
|
export type { Coordinates, ReGeocode, LocationOptions, LocationListener, GeoLanguage, LocationProtocol, } from './location.types';
|
|
9
9
|
export { LocationAccuracy, LocationMode, CoordinateType, } from './location.types';
|
|
10
10
|
export type { MarkerProps, PolylineProps, PolygonProps, CircleProps, HeatMapProps, MultiPointItem, MultiPointProps, ClusterParams, ClusterPoint, ClusterProps, } from './overlays.types';
|
|
11
11
|
export type { ExpoGaodeMapModule } from './native-module.types';
|
|
12
|
+
export type { FitToCoordinatesOptions } from './route-playback.types';
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/map/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,KAAK,EACL,MAAM,EACN,WAAW,EACX,MAAM,EACN,YAAY,EACZ,cAAc,EACd,UAAU,EACV,SAAS,EACT,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,YAAY,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,cAAc,EACd,UAAU,EACV,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,WAAW,EACX,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACf,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/map/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,KAAK,EACL,MAAM,EACN,WAAW,EACX,MAAM,EACN,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,UAAU,EACV,SAAS,EACT,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,YAAY,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,cAAc,EACd,UAAU,EACV,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,WAAW,EACX,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACf,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/map/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/map/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAsBzC,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACf,MAAM,kBAAkB,CAAC","sourcesContent":["/**\n * 高德地图 Expo Module 类型定义统一导出\n * 基于 Expo Modules API 重新设计\n */\n\n// 通用类型\nexport type {\n Point,\n LatLng,\n LatLngPoint,\n MapPoi,\n LatLngBounds,\n CameraPosition,\n CameraUpdate,\n ColorValue,\n SDKConfig,\n PermissionStatus,\n} from './common.types';\n\nexport { MapType } from './common.types';\n\n// 地图视图类型\nexport type {\n LocationEvent,\n CameraEvent,\n MapViewProps,\n MapViewMethods,\n MapViewRef,\n ExpoGaodeMapModuleEvents,\n} from './map-view.types';\n\n// 定位类型\nexport type {\n Coordinates,\n ReGeocode,\n LocationOptions,\n LocationListener,\n GeoLanguage,\n LocationProtocol,\n} from './location.types';\n\nexport {\n LocationAccuracy,\n LocationMode,\n CoordinateType,\n} from './location.types';\n\n// 覆盖物类型\nexport type {\n MarkerProps,\n PolylineProps,\n PolygonProps,\n CircleProps,\n HeatMapProps,\n MultiPointItem,\n MultiPointProps,\n ClusterParams,\n ClusterPoint,\n ClusterProps,\n} from './overlays.types';\n\n// 原生模块类型\nexport type { ExpoGaodeMapModule } from './native-module.types';\nexport type { FitToCoordinatesOptions } from './route-playback.types';\n"]}
|
|
@@ -306,4 +306,27 @@ export interface LocationOptions {
|
|
|
306
306
|
* 定位事件监听器
|
|
307
307
|
*/
|
|
308
308
|
export type LocationListener = (location: Coordinates | ReGeocode) => void;
|
|
309
|
+
/**
|
|
310
|
+
* 方向更新事件数据
|
|
311
|
+
*/
|
|
312
|
+
export interface HeadingUpdate {
|
|
313
|
+
/** 磁北方向角度 (0-359.9) */
|
|
314
|
+
magneticHeading: number;
|
|
315
|
+
/** 真北方向角度 (0-359.9) */
|
|
316
|
+
trueHeading: number;
|
|
317
|
+
/** 方向精度 */
|
|
318
|
+
headingAccuracy: number;
|
|
319
|
+
/** X 轴原始数据 */
|
|
320
|
+
x: number;
|
|
321
|
+
/** Y 轴原始数据 */
|
|
322
|
+
y: number;
|
|
323
|
+
/** Z 轴原始数据 */
|
|
324
|
+
z: number;
|
|
325
|
+
/** 时间戳 */
|
|
326
|
+
timestamp: number;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* 方向事件监听器
|
|
330
|
+
*/
|
|
331
|
+
export type HeadingListener = (heading: HeadingUpdate) => void;
|
|
309
332
|
//# sourceMappingURL=location.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location.types.d.ts","sourceRoot":"","sources":["../../../src/map/types/location.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,MAAM;IACzC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;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AAC;IAEV,cAAc;IACd,CAAC,EAAE,MAAM,CAAC;IAEV,UAAU;IACV,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location.types.js","sourceRoot":"","sources":["../../../src/map/types/location.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2HH;;;GAGG;AACH,MAAM,CAAN,IAAY,gBA8BX;AA9BD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,iFAAqB,CAAA;IAErB;;OAEG;IACH,uDAAQ,CAAA;IAER;;OAEG;IACH,+EAAoB,CAAA;IAEpB;;OAEG;IACH,yEAAiB,CAAA;IAEjB;;OAEG;IACH,iEAAa,CAAA;IAEb;;OAEG;IACH,6EAAmB,CAAA;AACrB,CAAC,EA9BW,gBAAgB,KAAhB,gBAAgB,QA8B3B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,YAeX;AAfD,WAAY,YAAY;IACtB;;OAEG;IACH,+DAAgB,CAAA;IAEhB;;OAEG;IACH,iEAAiB,CAAA;IAEjB;;OAEG;IACH,iEAAiB,CAAA;AACnB,CAAC,EAfW,YAAY,KAAZ,YAAY,QAevB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAwCX;AAxCD,WAAY,cAAc;IACxB;;OAEG;IACH,oDAAS,CAAA;IAET;;OAEG;IACH,qDAAS,CAAA;IAET;;OAEG;IACH,uDAAU,CAAA;IAEV;;OAEG;IACH,uDAAU,CAAA;IAEV;;OAEG;IACH,yDAAW,CAAA;IAEX;;OAEG;IACH,uDAAU,CAAA;IAEV;;OAEG;IACH,uDAAU,CAAA;IAEV;;OAEG;IACH,iDAAO,CAAA;AACT,CAAC,EAxCW,cAAc,KAAd,cAAc,QAwCzB","sourcesContent":["/**\n * 高德地图定位相关类型定义\n * 基于 Expo Modules API\n */\n\nimport type { LatLng } from './common.types';\n\n/**\n * 坐标信息(基础定位)\n */\nexport interface Coordinates extends LatLng {\n /**\n * 海拔高度(米)\n */\n altitude: number;\n\n /**\n * 水平精度(米)\n */\n accuracy: number;\n\n /**\n * 移动方向(度,需要 GPS)\n */\n heading: number;\n\n /**\n * 移动速度(米/秒,需要 GPS)\n */\n speed: number;\n\n /**\n * 时间戳\n */\n timestamp: number;\n\n /**\n * 是否有可用坐标\n * @platform ios\n */\n isAvailableCoordinate?: boolean;\n\n /**\n * 格式化地址(仅在启用逆地理编码时可用)\n */\n address?: string;\n}\n\n/**\n * 逆地理编码信息\n */\nexport interface ReGeocode extends Coordinates {\n /**\n * 格式化地址\n */\n address: string;\n\n /**\n * 国家\n */\n country: string;\n\n /**\n * 省/直辖市,如 `湖北省`\n */\n province: string;\n\n /**\n * 市,如 `武汉市`\n */\n city: string;\n\n /**\n * 区,如 `武昌区`\n */\n district: string;\n\n /**\n * 城市编码\n */\n cityCode: string;\n\n /**\n * 区域编码\n */\n adCode: string;\n\n /**\n * 街道名称\n */\n street: string;\n\n /**\n * 门牌号\n */\n streetNumber: string;\n\n /**\n * 兴趣点名称\n */\n poiName: string;\n\n /**\n * 所属兴趣点名称\n */\n aoiName: string;\n\n /**\n * 定位信息描述\n * @platform android\n */\n description?: string;\n\n /**\n * 坐标系类型\n * @platform android\n */\n coordType?: 'GCJ02' | 'WGS84';\n\n /**\n * 室内定位建筑物ID\n * @platform android\n */\n buildingId?: string;\n}\n\n/**\n * 定位精度级别\n * @platform ios\n */\nexport enum LocationAccuracy {\n /**\n * 最适合导航\n */\n BestForNavigation = 0,\n\n /**\n * 最高精度(约10米,耗时约10秒)\n */\n Best = 1,\n\n /**\n * 10米精度\n */\n NearestTenMeters = 2,\n\n /**\n * 100米精度(推荐)\n */\n HundredMeters = 3,\n\n /**\n * 1公里精度\n */\n Kilometer = 4,\n\n /**\n * 3公里精度\n */\n ThreeKilometers = 5,\n}\n\n/**\n * 定位模式\n * @platform android\n */\nexport enum LocationMode {\n /**\n * 高精度模式(网络+卫星)\n */\n HighAccuracy = 1,\n\n /**\n * 低功耗模式(仅网络)\n */\n BatterySaving = 2,\n\n /**\n * 仅设备模式(仅卫星)\n */\n DeviceSensors = 3,\n}\n\n/**\n * 坐标系类型\n */\nexport enum CoordinateType {\n /**\n * 高德坐标系\n */\n AMap = -1,\n\n /**\n * 百度坐标系\n */\n Baidu = 0,\n\n /**\n * MapBar坐标系\n */\n MapBar = 1,\n\n /**\n * MapABC坐标系\n */\n MapABC = 2,\n\n /**\n * 搜搜地图坐标系\n */\n SoSoMap = 3,\n\n /**\n * 阿里云坐标系\n */\n AliYun = 4,\n\n /**\n * 谷歌坐标系\n */\n Google = 5,\n\n /**\n * GPS坐标系\n */\n GPS = 6,\n}\n\n/**\n * 地理语言\n */\nexport type GeoLanguage = 'DEFAULT' | 'EN' | 'ZH';\n\n/**\n * 网络协议\n * @platform android\n */\nexport type LocationProtocol = 'HTTP' | 'HTTPS';\n\n/**\n * 定位配置选项\n */\nexport interface LocationOptions {\n /**\n * 是否返回逆地理信息\n * @default true\n */\n withReGeocode?: boolean;\n\n /**\n * 定位精度\n * @platform ios\n */\n accuracy?: LocationAccuracy;\n\n /**\n * 定位模式\n * @platform android\n */\n mode?: LocationMode;\n\n /**\n * 是否单次定位\n * @platform android\n * @default false\n */\n onceLocation?: boolean;\n\n /**\n * 定位间隔(毫秒)\n * @platform android\n * @default 2000\n */\n interval?: number;\n\n /**\n * 定位超时时间(秒)\n * @platform ios\n * @default 10\n */\n timeout?: number;\n\n /**\n * 逆地理编码超时时间(秒)\n * @platform ios\n * @default 2\n */\n reGeocodeTimeout?: number;\n\n /**\n * 最小更新距离(米)\n * @platform ios\n */\n distanceFilter?: number;\n\n /**\n * 是否启用设备传感器\n * @platform android\n * @default false\n */\n sensorEnable?: boolean;\n\n /**\n * 是否允许WIFI刷新\n * @platform android\n * @default true\n */\n wifiScan?: boolean;\n\n /**\n * 是否GPS优先\n * @platform android\n * @default false\n */\n gpsFirst?: boolean;\n\n /**\n * 是否等待WIFI列表刷新\n * 定位精度会更高,但是定位速度会变慢1-3秒\n * @platform android\n * @default false\n */\n onceLocationLatest?: boolean;\n\n /**\n * 逆地理语言\n */\n geoLanguage?: GeoLanguage;\n\n /**\n * 是否允许后台定位\n * @default false\n */\n allowsBackgroundLocationUpdates?: boolean;\n\n /**\n * 是否自动暂停定位\n * @platform ios\n * @default false\n */\n pausesLocationUpdatesAutomatically?: boolean;\n\n /**\n * 是否使用缓存策略\n * @platform android\n * @default true\n */\n locationCacheEnable?: boolean;\n\n /**\n * 网络请求超时时间(毫秒)\n * @platform android\n * @default 30000\n */\n httpTimeout?: number;\n\n /**\n * 网络协议\n * @platform android\n * @default 'HTTP'\n */\n protocol?: LocationProtocol;\n}\n\n/**\n * 定位事件监听器\n */\nexport type LocationListener = (location: Coordinates | ReGeocode) => void;\n\n\n\n\n"]}
|
|
1
|
+
{"version":3,"file":"location.types.js","sourceRoot":"","sources":["../../../src/map/types/location.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2HH;;;GAGG;AACH,MAAM,CAAN,IAAY,gBA8BX;AA9BD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,iFAAqB,CAAA;IAErB;;OAEG;IACH,uDAAQ,CAAA;IAER;;OAEG;IACH,+EAAoB,CAAA;IAEpB;;OAEG;IACH,yEAAiB,CAAA;IAEjB;;OAEG;IACH,iEAAa,CAAA;IAEb;;OAEG;IACH,6EAAmB,CAAA;AACrB,CAAC,EA9BW,gBAAgB,KAAhB,gBAAgB,QA8B3B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,YAeX;AAfD,WAAY,YAAY;IACtB;;OAEG;IACH,+DAAgB,CAAA;IAEhB;;OAEG;IACH,iEAAiB,CAAA;IAEjB;;OAEG;IACH,iEAAiB,CAAA;AACnB,CAAC,EAfW,YAAY,KAAZ,YAAY,QAevB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAwCX;AAxCD,WAAY,cAAc;IACxB;;OAEG;IACH,oDAAS,CAAA;IAET;;OAEG;IACH,qDAAS,CAAA;IAET;;OAEG;IACH,uDAAU,CAAA;IAEV;;OAEG;IACH,uDAAU,CAAA;IAEV;;OAEG;IACH,yDAAW,CAAA;IAEX;;OAEG;IACH,uDAAU,CAAA;IAEV;;OAEG;IACH,uDAAU,CAAA;IAEV;;OAEG;IACH,iDAAO,CAAA;AACT,CAAC,EAxCW,cAAc,KAAd,cAAc,QAwCzB","sourcesContent":["/**\n * 高德地图定位相关类型定义\n * 基于 Expo Modules API\n */\n\nimport type { LatLng } from './common.types';\n\n/**\n * 坐标信息(基础定位)\n */\nexport interface Coordinates extends LatLng {\n /**\n * 海拔高度(米)\n */\n altitude: number;\n\n /**\n * 水平精度(米)\n */\n accuracy: number;\n\n /**\n * 移动方向(度,需要 GPS)\n */\n heading: number;\n\n /**\n * 移动速度(米/秒,需要 GPS)\n */\n speed: number;\n\n /**\n * 时间戳\n */\n timestamp: number;\n\n /**\n * 是否有可用坐标\n * @platform ios\n */\n isAvailableCoordinate?: boolean;\n\n /**\n * 格式化地址(仅在启用逆地理编码时可用)\n */\n address?: string;\n}\n\n/**\n * 逆地理编码信息\n */\nexport interface ReGeocode extends Coordinates {\n /**\n * 格式化地址\n */\n address: string;\n\n /**\n * 国家\n */\n country: string;\n\n /**\n * 省/直辖市,如 `湖北省`\n */\n province: string;\n\n /**\n * 市,如 `武汉市`\n */\n city: string;\n\n /**\n * 区,如 `武昌区`\n */\n district: string;\n\n /**\n * 城市编码\n */\n cityCode: string;\n\n /**\n * 区域编码\n */\n adCode: string;\n\n /**\n * 街道名称\n */\n street: string;\n\n /**\n * 门牌号\n */\n streetNumber: string;\n\n /**\n * 兴趣点名称\n */\n poiName: string;\n\n /**\n * 所属兴趣点名称\n */\n aoiName: string;\n\n /**\n * 定位信息描述\n * @platform android\n */\n description?: string;\n\n /**\n * 坐标系类型\n * @platform android\n */\n coordType?: 'GCJ02' | 'WGS84';\n\n /**\n * 室内定位建筑物ID\n * @platform android\n */\n buildingId?: string;\n}\n\n/**\n * 定位精度级别\n * @platform ios\n */\nexport enum LocationAccuracy {\n /**\n * 最适合导航\n */\n BestForNavigation = 0,\n\n /**\n * 最高精度(约10米,耗时约10秒)\n */\n Best = 1,\n\n /**\n * 10米精度\n */\n NearestTenMeters = 2,\n\n /**\n * 100米精度(推荐)\n */\n HundredMeters = 3,\n\n /**\n * 1公里精度\n */\n Kilometer = 4,\n\n /**\n * 3公里精度\n */\n ThreeKilometers = 5,\n}\n\n/**\n * 定位模式\n * @platform android\n */\nexport enum LocationMode {\n /**\n * 高精度模式(网络+卫星)\n */\n HighAccuracy = 1,\n\n /**\n * 低功耗模式(仅网络)\n */\n BatterySaving = 2,\n\n /**\n * 仅设备模式(仅卫星)\n */\n DeviceSensors = 3,\n}\n\n/**\n * 坐标系类型\n */\nexport enum CoordinateType {\n /**\n * 高德坐标系\n */\n AMap = -1,\n\n /**\n * 百度坐标系\n */\n Baidu = 0,\n\n /**\n * MapBar坐标系\n */\n MapBar = 1,\n\n /**\n * MapABC坐标系\n */\n MapABC = 2,\n\n /**\n * 搜搜地图坐标系\n */\n SoSoMap = 3,\n\n /**\n * 阿里云坐标系\n */\n AliYun = 4,\n\n /**\n * 谷歌坐标系\n */\n Google = 5,\n\n /**\n * GPS坐标系\n */\n GPS = 6,\n}\n\n/**\n * 地理语言\n */\nexport type GeoLanguage = 'DEFAULT' | 'EN' | 'ZH';\n\n/**\n * 网络协议\n * @platform android\n */\nexport type LocationProtocol = 'HTTP' | 'HTTPS';\n\n/**\n * 定位配置选项\n */\nexport interface LocationOptions {\n /**\n * 是否返回逆地理信息\n * @default true\n */\n withReGeocode?: boolean;\n\n /**\n * 定位精度\n * @platform ios\n */\n accuracy?: LocationAccuracy;\n\n /**\n * 定位模式\n * @platform android\n */\n mode?: LocationMode;\n\n /**\n * 是否单次定位\n * @platform android\n * @default false\n */\n onceLocation?: boolean;\n\n /**\n * 定位间隔(毫秒)\n * @platform android\n * @default 2000\n */\n interval?: number;\n\n /**\n * 定位超时时间(秒)\n * @platform ios\n * @default 10\n */\n timeout?: number;\n\n /**\n * 逆地理编码超时时间(秒)\n * @platform ios\n * @default 2\n */\n reGeocodeTimeout?: number;\n\n /**\n * 最小更新距离(米)\n * @platform ios\n */\n distanceFilter?: number;\n\n /**\n * 是否启用设备传感器\n * @platform android\n * @default false\n */\n sensorEnable?: boolean;\n\n /**\n * 是否允许WIFI刷新\n * @platform android\n * @default true\n */\n wifiScan?: boolean;\n\n /**\n * 是否GPS优先\n * @platform android\n * @default false\n */\n gpsFirst?: boolean;\n\n /**\n * 是否等待WIFI列表刷新\n * 定位精度会更高,但是定位速度会变慢1-3秒\n * @platform android\n * @default false\n */\n onceLocationLatest?: boolean;\n\n /**\n * 逆地理语言\n */\n geoLanguage?: GeoLanguage;\n\n /**\n * 是否允许后台定位\n * @default false\n */\n allowsBackgroundLocationUpdates?: boolean;\n\n /**\n * 是否自动暂停定位\n * @platform ios\n * @default false\n */\n pausesLocationUpdatesAutomatically?: boolean;\n\n /**\n * 是否使用缓存策略\n * @platform android\n * @default true\n */\n locationCacheEnable?: boolean;\n\n /**\n * 网络请求超时时间(毫秒)\n * @platform android\n * @default 30000\n */\n httpTimeout?: number;\n\n /**\n * 网络协议\n * @platform android\n * @default 'HTTP'\n */\n protocol?: LocationProtocol;\n}\n\n/**\n * 定位事件监听器\n */\nexport type LocationListener = (location: Coordinates | ReGeocode) => void;\n\n/**\n * 方向更新事件数据\n */\nexport interface HeadingUpdate {\n /** 磁北方向角度 (0-359.9) */\n magneticHeading: number;\n\n /** 真北方向角度 (0-359.9) */\n trueHeading: number;\n\n /** 方向精度 */\n headingAccuracy: number;\n\n /** X 轴原始数据 */\n x: number;\n\n /** Y 轴原始数据 */\n y: number;\n\n /** Z 轴原始数据 */\n z: number;\n\n /** 时间戳 */\n timestamp: number;\n}\n\n/**\n * 方向事件监听器\n */\nexport type HeadingListener = (heading: HeadingUpdate) => void;\n\n\n\n"]}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* 基于 Expo Modules API
|
|
4
4
|
*/
|
|
5
5
|
import type { StyleProp, ViewStyle, NativeSyntheticEvent } from 'react-native';
|
|
6
|
-
import type { CameraPosition, LatLng, LatLngBounds, MapPoi, MapType, Point, LatLngPoint } from './common.types';
|
|
7
|
-
import { Coordinates, ReGeocode } from './location.types';
|
|
6
|
+
import type { CameraPosition, CameraUpdate, LatLng, LatLngBounds, MapPoi, MapType, Point, LatLngPoint } from './common.types';
|
|
7
|
+
import type { Coordinates, ReGeocode, HeadingUpdate } from './location.types';
|
|
8
|
+
import type { FitToCoordinatesOptions } from './route-playback.types';
|
|
8
9
|
/**
|
|
9
10
|
* 定位事件数据
|
|
10
11
|
*/
|
|
@@ -235,8 +236,15 @@ export interface MapViewProps {
|
|
|
235
236
|
onMapLongPress?: (event: NativeSyntheticEvent<LatLng>) => void;
|
|
236
237
|
/**
|
|
237
238
|
* 地图状态改变事件(实时触发)
|
|
239
|
+
* 可配合 `cameraEventThrottleMs` 控制事件频率
|
|
238
240
|
*/
|
|
239
241
|
onCameraMove?: (event: NativeSyntheticEvent<CameraEvent>) => void;
|
|
242
|
+
/**
|
|
243
|
+
* 地图移动事件节流间隔(毫秒)
|
|
244
|
+
* `0` 表示不节流
|
|
245
|
+
* @default 32
|
|
246
|
+
*/
|
|
247
|
+
cameraEventThrottleMs?: number;
|
|
240
248
|
/**
|
|
241
249
|
* 地图状态改变完成事件
|
|
242
250
|
*/
|
|
@@ -263,7 +271,7 @@ export interface MapViewMethods {
|
|
|
263
271
|
* @param cameraPosition 目标相机位置
|
|
264
272
|
* @param duration 动画时长(毫秒)
|
|
265
273
|
*/
|
|
266
|
-
moveCamera(cameraPosition:
|
|
274
|
+
moveCamera(cameraPosition: CameraUpdate, duration?: number): Promise<void>;
|
|
267
275
|
/**
|
|
268
276
|
* 将屏幕坐标转换为地理坐标
|
|
269
277
|
* @param point 屏幕坐标
|
|
@@ -275,13 +283,13 @@ export interface MapViewMethods {
|
|
|
275
283
|
* @param center 中心点
|
|
276
284
|
* @param animated 是否启用动画
|
|
277
285
|
*/
|
|
278
|
-
setCenter(center: LatLngPoint, animated?: boolean): void
|
|
286
|
+
setCenter(center: LatLngPoint, animated?: boolean): Promise<void>;
|
|
279
287
|
/**
|
|
280
288
|
* 设置地图缩放级别
|
|
281
289
|
* @param zoom 缩放级别
|
|
282
290
|
* @param animated 是否启用动画
|
|
283
291
|
*/
|
|
284
|
-
setZoom(zoom: number, animated?: boolean): void
|
|
292
|
+
setZoom(zoom: number, animated?: boolean): Promise<void>;
|
|
285
293
|
/**
|
|
286
294
|
* 获取相机位置
|
|
287
295
|
* @returns 相机位置
|
|
@@ -292,17 +300,22 @@ export interface MapViewMethods {
|
|
|
292
300
|
* @returns 快照图片文件路径
|
|
293
301
|
*/
|
|
294
302
|
takeSnapshot(): Promise<string>;
|
|
303
|
+
/**
|
|
304
|
+
* 根据坐标集合自动移动相机
|
|
305
|
+
*/
|
|
306
|
+
fitToCoordinates(points: LatLngPoint[], options?: FitToCoordinatesOptions): Promise<void>;
|
|
295
307
|
}
|
|
296
308
|
/**
|
|
297
309
|
* MapView Ref 公开接口(用户使用)
|
|
298
310
|
*/
|
|
299
311
|
export interface MapViewRef {
|
|
300
|
-
moveCamera(position:
|
|
312
|
+
moveCamera(position: CameraUpdate, duration?: number): Promise<void>;
|
|
301
313
|
getLatLng(point: Point): Promise<LatLng>;
|
|
302
314
|
setCenter(center: LatLngPoint, animated?: boolean): Promise<void>;
|
|
303
315
|
setZoom(zoom: number, animated?: boolean): Promise<void>;
|
|
304
316
|
getCameraPosition(): Promise<CameraPosition>;
|
|
305
317
|
takeSnapshot(): Promise<string>;
|
|
318
|
+
fitToCoordinates(points: LatLngPoint[], options?: FitToCoordinatesOptions): Promise<void>;
|
|
306
319
|
}
|
|
307
320
|
/**
|
|
308
321
|
* Expo 模块事件类型
|
|
@@ -320,21 +333,6 @@ export type ExpoGaodeMapModuleEvents = {
|
|
|
320
333
|
* 当设备方向发生变化时触发
|
|
321
334
|
* @param heading 方向信息
|
|
322
335
|
*/
|
|
323
|
-
onHeadingUpdate: (heading:
|
|
324
|
-
/** 磁北方向角度 (0-359.9) */
|
|
325
|
-
magneticHeading: number;
|
|
326
|
-
/** 真北方向角度 (0-359.9) */
|
|
327
|
-
trueHeading: number;
|
|
328
|
-
/** 方向精度 */
|
|
329
|
-
headingAccuracy: number;
|
|
330
|
-
/** X 轴原始数据 */
|
|
331
|
-
x: number;
|
|
332
|
-
/** Y 轴原始数据 */
|
|
333
|
-
y: number;
|
|
334
|
-
/** Z 轴原始数据 */
|
|
335
|
-
z: number;
|
|
336
|
-
/** 时间戳 */
|
|
337
|
-
timestamp: number;
|
|
338
|
-
}) => void;
|
|
336
|
+
onHeadingUpdate: (heading: HeadingUpdate) => void;
|
|
339
337
|
};
|
|
340
338
|
//# sourceMappingURL=map-view.types.d.ts.map
|