expo-gaode-map 2.2.30-next.0 → 2.2.30
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/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapModule.kt +4 -2
- package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapView.kt +117 -57
- package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapViewModule.kt +8 -15
- package/android/src/main/java/expo/modules/gaodemap/managers/UIManager.kt +20 -6
- package/android/src/main/java/expo/modules/gaodemap/overlays/ClusterView.kt +24 -13
- package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerBitmapRenderer.kt +351 -0
- package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerView.kt +94 -310
- package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerViewModule.kt +3 -3
- package/build/ExpoGaodeMapModule.d.ts +13 -5
- package/build/ExpoGaodeMapModule.d.ts.map +1 -1
- package/build/ExpoGaodeMapModule.js +166 -34
- package/build/ExpoGaodeMapModule.js.map +1 -1
- package/build/ExpoGaodeMapView.d.ts.map +1 -1
- package/build/ExpoGaodeMapView.js +12 -0
- package/build/ExpoGaodeMapView.js.map +1 -1
- package/build/components/AreaMaskOverlay.d.ts +5 -0
- package/build/components/AreaMaskOverlay.d.ts.map +1 -0
- package/build/components/AreaMaskOverlay.js +20 -0
- package/build/components/AreaMaskOverlay.js.map +1 -0
- package/build/components/FoldableMapView.d.ts.map +1 -1
- package/build/components/FoldableMapView.js +115 -104
- package/build/components/FoldableMapView.js.map +1 -1
- package/build/components/RouteOverlay.d.ts +5 -0
- package/build/components/RouteOverlay.d.ts.map +1 -0
- package/build/components/RouteOverlay.js +20 -0
- package/build/components/RouteOverlay.js.map +1 -0
- package/build/components/overlays/Cluster.d.ts.map +1 -1
- package/build/components/overlays/Cluster.js +12 -0
- package/build/components/overlays/Cluster.js.map +1 -1
- package/build/components/overlays/Marker.d.ts.map +1 -1
- package/build/components/overlays/Marker.js +86 -3
- package/build/components/overlays/Marker.js.map +1 -1
- package/build/hooks/useRoutePlayback.d.ts +4 -0
- package/build/hooks/useRoutePlayback.d.ts.map +1 -0
- package/build/hooks/useRoutePlayback.js +310 -0
- package/build/hooks/useRoutePlayback.js.map +1 -0
- package/build/index.d.ts +4 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -2
- package/build/index.js.map +1 -1
- package/build/types/common.types.d.ts +29 -5
- package/build/types/common.types.d.ts.map +1 -1
- package/build/types/common.types.js +5 -5
- package/build/types/common.types.js.map +1 -1
- package/build/types/index.d.ts +3 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/index.js.map +1 -1
- package/build/types/location.types.d.ts +28 -0
- package/build/types/location.types.d.ts.map +1 -1
- package/build/types/location.types.js +5 -0
- package/build/types/location.types.js.map +1 -1
- package/build/types/map-view.types.d.ts +22 -22
- package/build/types/map-view.types.d.ts.map +1 -1
- package/build/types/map-view.types.js.map +1 -1
- package/build/types/native-module.types.d.ts +2 -2
- package/build/types/native-module.types.d.ts.map +1 -1
- package/build/types/native-module.types.js.map +1 -1
- package/build/types/overlays.types.d.ts +14 -0
- package/build/types/overlays.types.d.ts.map +1 -1
- package/build/types/overlays.types.js.map +1 -1
- package/build/types/route-playback.types.d.ts +118 -0
- package/build/types/route-playback.types.d.ts.map +1 -0
- package/build/types/route-playback.types.js +2 -0
- package/build/types/route-playback.types.js.map +1 -0
- package/build/utils/RouteUtils.d.ts +8 -0
- package/build/utils/RouteUtils.d.ts.map +1 -0
- package/build/utils/RouteUtils.js +140 -0
- package/build/utils/RouteUtils.js.map +1 -0
- package/ios/ExpoGaodeMapModule.swift +41 -22
- package/ios/ExpoGaodeMapView.swift +236 -241
- package/ios/ExpoGaodeMapViewModule.swift +16 -11
- package/ios/managers/UIManager.swift +5 -4
- package/ios/modules/LocationManager.swift +32 -9
- package/ios/overlays/ClusterView.swift +114 -12
- package/ios/overlays/ClusterViewModule.swift +5 -1
- package/ios/overlays/MarkerView.swift +195 -18
- package/ios/overlays/MarkerViewModule.swift +7 -7
- package/package.json +6 -6
- package/build/utils/throttle.d.ts +0 -10
- package/build/utils/throttle.d.ts.map +0 -1
- package/build/utils/throttle.js +0 -19
- package/build/utils/throttle.js.map +0 -1
|
@@ -154,9 +154,9 @@ class MarkerView: ExpoView {
|
|
|
154
154
|
|
|
155
155
|
// JS 侧可以调用
|
|
156
156
|
func setCacheKey(_ key: String?) {
|
|
157
|
+
guard cacheKey != key else { return }
|
|
157
158
|
self.cacheKey = key
|
|
158
|
-
|
|
159
|
-
updateAnnotation()
|
|
159
|
+
refreshAnnotationAppearance(invalidateChildrenCache: !subviews.isEmpty)
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
/**
|
|
@@ -234,7 +234,9 @@ class MarkerView: ExpoView {
|
|
|
234
234
|
let key = childrenCacheKey(for: size)
|
|
235
235
|
if let cached = IconBitmapCache.shared.image(forKey: key) {
|
|
236
236
|
annotationView?.image = cached
|
|
237
|
-
annotationView
|
|
237
|
+
if let annotationView = annotationView {
|
|
238
|
+
applyCenterOffset(to: annotationView, defaultOffset: .zero)
|
|
239
|
+
}
|
|
238
240
|
return annotationView
|
|
239
241
|
}
|
|
240
242
|
|
|
@@ -243,7 +245,7 @@ class MarkerView: ExpoView {
|
|
|
243
245
|
guard let self = self, let annotationView = annotationView else { return }
|
|
244
246
|
if let generated = self.createImageFromSubviews() {
|
|
245
247
|
annotationView.image = generated
|
|
246
|
-
|
|
248
|
+
self.applyCenterOffset(to: annotationView, defaultOffset: .zero)
|
|
247
249
|
}
|
|
248
250
|
}
|
|
249
251
|
return annotationView
|
|
@@ -251,10 +253,12 @@ class MarkerView: ExpoView {
|
|
|
251
253
|
|
|
252
254
|
// 2. 如果有 icon 属性,使用自定义图标
|
|
253
255
|
if let iconUri = iconUri, !iconUri.isEmpty {
|
|
254
|
-
let key =
|
|
256
|
+
let key = iconCacheKey(for: iconUri)
|
|
255
257
|
if let cached = IconBitmapCache.shared.image(forKey: key) {
|
|
256
258
|
annotationView?.image = cached
|
|
257
|
-
annotationView
|
|
259
|
+
if let annotationView = annotationView {
|
|
260
|
+
applyCenterOffset(to: annotationView, defaultOffset: CGPoint(x: 0, y: -cached.size.height / 2))
|
|
261
|
+
}
|
|
258
262
|
return annotationView
|
|
259
263
|
}
|
|
260
264
|
|
|
@@ -270,7 +274,7 @@ class MarkerView: ExpoView {
|
|
|
270
274
|
if let img = resizedImage {
|
|
271
275
|
IconBitmapCache.shared.setImage(img, forKey: key)
|
|
272
276
|
annotationView.image = img
|
|
273
|
-
|
|
277
|
+
self.applyCenterOffset(to: annotationView, defaultOffset: CGPoint(x: 0, y: -img.size.height / 2))
|
|
274
278
|
}
|
|
275
279
|
}
|
|
276
280
|
return annotationView
|
|
@@ -328,8 +332,9 @@ class MarkerView: ExpoView {
|
|
|
328
332
|
// 1) 如果缓存命中,直接同步返回图像(fast path)
|
|
329
333
|
if let cached = IconBitmapCache.shared.image(forKey: key) {
|
|
330
334
|
annotationView?.image = cached
|
|
331
|
-
|
|
332
|
-
|
|
335
|
+
if let annotationView = annotationView {
|
|
336
|
+
applyCenterOffset(to: annotationView, defaultOffset: .zero)
|
|
337
|
+
}
|
|
333
338
|
return annotationView
|
|
334
339
|
}
|
|
335
340
|
|
|
@@ -345,15 +350,16 @@ class MarkerView: ExpoView {
|
|
|
345
350
|
// 再次检查缓存(避免重复渲染)
|
|
346
351
|
if let cached = IconBitmapCache.shared.image(forKey: key) {
|
|
347
352
|
annotationView.image = cached
|
|
348
|
-
|
|
353
|
+
self.applyCenterOffset(to: annotationView, defaultOffset: .zero)
|
|
349
354
|
return
|
|
350
355
|
}
|
|
351
356
|
|
|
352
357
|
// 调用你的原生渲染逻辑(保留空白检测、多次 layout)
|
|
353
358
|
if let generated = self.createImageFromSubviews() {
|
|
354
359
|
annotationView.image = generated
|
|
355
|
-
|
|
356
|
-
} else {
|
|
360
|
+
self.applyCenterOffset(to: annotationView, defaultOffset: .zero)
|
|
361
|
+
} else if self.hasPendingImageContent() {
|
|
362
|
+
self.scheduleSubviewRefresh(allowFallbackToDefault: false)
|
|
357
363
|
}
|
|
358
364
|
}
|
|
359
365
|
|
|
@@ -385,10 +391,12 @@ class MarkerView: ExpoView {
|
|
|
385
391
|
self.annotationView = annotationView
|
|
386
392
|
|
|
387
393
|
// 构建 key
|
|
388
|
-
let key =
|
|
394
|
+
let key = iconCacheKey(for: iconUri)
|
|
389
395
|
if let cached = IconBitmapCache.shared.image(forKey: key) {
|
|
390
396
|
annotationView?.image = cached
|
|
391
|
-
annotationView
|
|
397
|
+
if let annotationView = annotationView {
|
|
398
|
+
applyCenterOffset(to: annotationView, defaultOffset: CGPoint(x: 0, y: -cached.size.height / 2))
|
|
399
|
+
}
|
|
392
400
|
return annotationView
|
|
393
401
|
}
|
|
394
402
|
|
|
@@ -405,7 +413,9 @@ class MarkerView: ExpoView {
|
|
|
405
413
|
if let img = resizedImage {
|
|
406
414
|
IconBitmapCache.shared.setImage(img, forKey: key)
|
|
407
415
|
annotationView?.image = img
|
|
408
|
-
annotationView
|
|
416
|
+
if let annotationView = annotationView {
|
|
417
|
+
self.applyCenterOffset(to: annotationView, defaultOffset: CGPoint(x: 0, y: -img.size.height / 2))
|
|
418
|
+
}
|
|
409
419
|
}
|
|
410
420
|
}
|
|
411
421
|
}
|
|
@@ -445,6 +455,9 @@ class MarkerView: ExpoView {
|
|
|
445
455
|
pinView?.canShowCallout = canShowCallout
|
|
446
456
|
pinView?.isDraggable = draggable
|
|
447
457
|
pinView?.animatesDrop = animatesDrop
|
|
458
|
+
if let pinView = pinView {
|
|
459
|
+
applyCenterOffset(to: pinView, defaultOffset: .zero)
|
|
460
|
+
}
|
|
448
461
|
|
|
449
462
|
self.annotationView = pinView
|
|
450
463
|
return pinView
|
|
@@ -506,6 +519,10 @@ class MarkerView: ExpoView {
|
|
|
506
519
|
forceLayoutRecursively(view: firstSubview)
|
|
507
520
|
RunLoop.current.run(until: Date(timeIntervalSinceNow: 0.01))
|
|
508
521
|
}
|
|
522
|
+
|
|
523
|
+
if containsPendingImageContent(in: firstSubview) {
|
|
524
|
+
return nil
|
|
525
|
+
}
|
|
509
526
|
|
|
510
527
|
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
|
|
511
528
|
defer { UIGraphicsEndImageContext() }
|
|
@@ -528,6 +545,41 @@ class MarkerView: ExpoView {
|
|
|
528
545
|
return image
|
|
529
546
|
}
|
|
530
547
|
|
|
548
|
+
private func iconCacheKey(for iconUri: String) -> String {
|
|
549
|
+
let baseKey = cacheKey ?? "icon|\(iconUri)"
|
|
550
|
+
return "\(baseKey)|\(Int(iconWidth.rounded()))x\(Int(iconHeight.rounded()))"
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
private func applyCenterOffset(to annotationView: MAAnnotationView, defaultOffset: CGPoint) {
|
|
554
|
+
annotationView.centerOffset = resolvedCenterOffset(defaultOffset: defaultOffset)
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
private func resolvedCenterOffset(defaultOffset: CGPoint) -> CGPoint {
|
|
558
|
+
guard let centerOffset else {
|
|
559
|
+
return defaultOffset
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
let x = centerOffset["x"] ?? Double(defaultOffset.x)
|
|
563
|
+
let y = centerOffset["y"] ?? Double(defaultOffset.y)
|
|
564
|
+
return CGPoint(x: x, y: y)
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
private func currentDefaultCenterOffset() -> CGPoint {
|
|
568
|
+
if !subviews.isEmpty {
|
|
569
|
+
return .zero
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
if let image = annotationView?.image ?? animatedAnnotationView?.image {
|
|
573
|
+
return CGPoint(x: 0, y: -image.size.height / 2)
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
if let iconUri, !iconUri.isEmpty {
|
|
577
|
+
return CGPoint(x: 0, y: -iconHeight / 2)
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
return .zero
|
|
581
|
+
}
|
|
582
|
+
|
|
531
583
|
private func resolvedCustomSubviewSize(defaultSize: CGSize) -> CGSize {
|
|
532
584
|
guard let firstSubview = subviews.first else {
|
|
533
585
|
return defaultSize
|
|
@@ -570,7 +622,9 @@ class MarkerView: ExpoView {
|
|
|
570
622
|
}
|
|
571
623
|
|
|
572
624
|
private func childrenCacheKey(for size: CGSize) -> String {
|
|
573
|
-
let
|
|
625
|
+
let signature = childrenRenderSignature()
|
|
626
|
+
let baseKey = cacheKey.map { "\($0)|\(signature)" }
|
|
627
|
+
?? "children_\(ObjectIdentifier(self).hashValue)|\(signature)"
|
|
574
628
|
let roundedWidth = Int(ceil(size.width))
|
|
575
629
|
let roundedHeight = Int(ceil(size.height))
|
|
576
630
|
return "\(baseKey)|\(roundedWidth)x\(roundedHeight)"
|
|
@@ -607,6 +661,34 @@ class MarkerView: ExpoView {
|
|
|
607
661
|
return parts.joined(separator: "|")
|
|
608
662
|
}
|
|
609
663
|
|
|
664
|
+
private func hasPendingImageContent() -> Bool {
|
|
665
|
+
guard let firstSubview = subviews.first else {
|
|
666
|
+
return false
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
return containsPendingImageContent(in: firstSubview)
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
private func containsPendingImageContent(in view: UIView) -> Bool {
|
|
673
|
+
if view.isHidden || view.alpha <= 0 {
|
|
674
|
+
return false
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
if let imageView = view as? UIImageView {
|
|
678
|
+
let bounds = imageView.bounds
|
|
679
|
+
let hasSize = bounds.width > 0 || bounds.height > 0
|
|
680
|
+
if hasSize && imageView.image == nil {
|
|
681
|
+
return true
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
for subview in view.subviews where containsPendingImageContent(in: subview) {
|
|
686
|
+
return true
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
return false
|
|
690
|
+
}
|
|
691
|
+
|
|
610
692
|
|
|
611
693
|
/**
|
|
612
694
|
* 递归强制布局视图及其所有子视图
|
|
@@ -751,7 +833,7 @@ class MarkerView: ExpoView {
|
|
|
751
833
|
|
|
752
834
|
if let image = createImageFromSubviews() {
|
|
753
835
|
annotationView.image = image
|
|
754
|
-
|
|
836
|
+
applyCenterOffset(to: annotationView, defaultOffset: .zero)
|
|
755
837
|
annotationView.canShowCallout = false
|
|
756
838
|
annotationView.isDraggable = draggable
|
|
757
839
|
lastRenderedChildrenSignature = signature
|
|
@@ -768,6 +850,45 @@ class MarkerView: ExpoView {
|
|
|
768
850
|
IconBitmapCache.shared.removeImage(forKey: childrenCacheKey(for: size))
|
|
769
851
|
}
|
|
770
852
|
}
|
|
853
|
+
|
|
854
|
+
private func refreshAnnotationAppearance(invalidateChildrenCache: Bool = false) {
|
|
855
|
+
guard !isRemoving else { return }
|
|
856
|
+
|
|
857
|
+
let refresh = { [weak self] in
|
|
858
|
+
guard let self = self, let mapView = self.mapView else { return }
|
|
859
|
+
|
|
860
|
+
self.pendingSubviewRefreshTask?.cancel()
|
|
861
|
+
self.pendingSubviewRefreshTask = nil
|
|
862
|
+
|
|
863
|
+
if invalidateChildrenCache {
|
|
864
|
+
self.lastRenderedChildrenSignature = nil
|
|
865
|
+
if !self.subviews.isEmpty {
|
|
866
|
+
self.invalidateCurrentChildrenCache()
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
if let animatedAnnotation = self.animatedAnnotation {
|
|
871
|
+
self.animatedAnnotationView = nil
|
|
872
|
+
mapView.removeAnnotation(animatedAnnotation)
|
|
873
|
+
mapView.addAnnotation(animatedAnnotation)
|
|
874
|
+
return
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
if let annotation = self.annotation {
|
|
878
|
+
self.annotationView = nil
|
|
879
|
+
mapView.removeAnnotation(annotation)
|
|
880
|
+
mapView.addAnnotation(annotation)
|
|
881
|
+
} else {
|
|
882
|
+
self.updateAnnotation()
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
if Thread.isMainThread {
|
|
887
|
+
refresh()
|
|
888
|
+
} else {
|
|
889
|
+
DispatchQueue.main.async(execute: refresh)
|
|
890
|
+
}
|
|
891
|
+
}
|
|
771
892
|
|
|
772
893
|
/**
|
|
773
894
|
* 设置纬度
|
|
@@ -853,28 +974,83 @@ class MarkerView: ExpoView {
|
|
|
853
974
|
*/
|
|
854
975
|
func setDraggable(_ draggable: Bool) {
|
|
855
976
|
self.draggable = draggable
|
|
977
|
+
annotationView?.isDraggable = draggable
|
|
978
|
+
animatedAnnotationView?.isDraggable = draggable
|
|
856
979
|
updateAnnotation()
|
|
857
980
|
}
|
|
858
981
|
|
|
859
982
|
func setIconUri(_ uri: String?) {
|
|
860
983
|
self.iconUri = uri
|
|
861
|
-
|
|
984
|
+
refreshAnnotationAppearance()
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
func setIconWidth(_ width: Double) {
|
|
988
|
+
guard iconWidth != width else { return }
|
|
989
|
+
iconWidth = width
|
|
990
|
+
if let iconUri, !iconUri.isEmpty {
|
|
991
|
+
refreshAnnotationAppearance()
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
func setIconHeight(_ height: Double) {
|
|
996
|
+
guard iconHeight != height else { return }
|
|
997
|
+
iconHeight = height
|
|
998
|
+
if let iconUri, !iconUri.isEmpty {
|
|
999
|
+
refreshAnnotationAppearance()
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
func setCustomViewWidth(_ width: Double) {
|
|
1004
|
+
guard customViewWidth != width else { return }
|
|
1005
|
+
customViewWidth = width
|
|
1006
|
+
if !subviews.isEmpty {
|
|
1007
|
+
refreshAnnotationAppearance(invalidateChildrenCache: true)
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
func setCustomViewHeight(_ height: Double) {
|
|
1012
|
+
guard customViewHeight != height else { return }
|
|
1013
|
+
customViewHeight = height
|
|
1014
|
+
if !subviews.isEmpty {
|
|
1015
|
+
refreshAnnotationAppearance(invalidateChildrenCache: true)
|
|
1016
|
+
}
|
|
862
1017
|
}
|
|
863
1018
|
|
|
864
1019
|
func setCenterOffset(_ offset: [String: Double]) {
|
|
865
1020
|
self.centerOffset = offset
|
|
1021
|
+
if let annotationView = annotationView {
|
|
1022
|
+
applyCenterOffset(to: annotationView, defaultOffset: currentDefaultCenterOffset())
|
|
1023
|
+
}
|
|
1024
|
+
if let animatedAnnotationView = animatedAnnotationView {
|
|
1025
|
+
applyCenterOffset(to: animatedAnnotationView, defaultOffset: currentDefaultCenterOffset())
|
|
1026
|
+
}
|
|
866
1027
|
}
|
|
867
1028
|
|
|
868
1029
|
func setAnimatesDrop(_ animate: Bool) {
|
|
869
1030
|
self.animatesDrop = animate
|
|
1031
|
+
(annotationView as? MAPinAnnotationView)?.animatesDrop = animate
|
|
870
1032
|
}
|
|
871
1033
|
|
|
872
1034
|
func setPinColor(_ color: String) {
|
|
1035
|
+
guard pinColor != color else { return }
|
|
873
1036
|
self.pinColor = color
|
|
1037
|
+
if subviews.isEmpty && (iconUri?.isEmpty ?? true) {
|
|
1038
|
+
refreshAnnotationAppearance()
|
|
1039
|
+
}
|
|
874
1040
|
}
|
|
875
1041
|
|
|
876
1042
|
func setCanShowCallout(_ show: Bool) {
|
|
877
1043
|
self.canShowCallout = show
|
|
1044
|
+
if subviews.isEmpty {
|
|
1045
|
+
annotationView?.canShowCallout = show
|
|
1046
|
+
animatedAnnotationView?.canShowCallout = show
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
func setGrowAnimation(_ enabled: Bool) {
|
|
1051
|
+
guard growAnimation != enabled else { return }
|
|
1052
|
+
growAnimation = enabled
|
|
1053
|
+
refreshAnnotationAppearance()
|
|
878
1054
|
}
|
|
879
1055
|
|
|
880
1056
|
// MARK: - 平滑移动相关方法
|
|
@@ -1085,6 +1261,7 @@ class MarkerView: ExpoView {
|
|
|
1085
1261
|
// 取消待处理的任务
|
|
1086
1262
|
pendingAddTask?.cancel()
|
|
1087
1263
|
pendingUpdateTask?.cancel()
|
|
1264
|
+
pendingSubviewRefreshTask?.cancel()
|
|
1088
1265
|
|
|
1089
1266
|
// 清理引用,防止内存泄漏
|
|
1090
1267
|
mapView = nil
|
|
@@ -34,19 +34,19 @@ public class MarkerViewModule: Module {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
Prop("iconWidth") { (view: MarkerView, width: Double) in
|
|
37
|
-
view.
|
|
37
|
+
view.setIconWidth(width)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
Prop("iconHeight") { (view: MarkerView, height: Double) in
|
|
41
|
-
view.
|
|
41
|
+
view.setIconHeight(height)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
Prop("customViewWidth") { (view: MarkerView, width: Double) in
|
|
45
|
-
view.
|
|
45
|
+
view.setCustomViewWidth(width)
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
Prop("customViewHeight") { (view: MarkerView, height: Double) in
|
|
49
|
-
view.
|
|
49
|
+
view.setCustomViewHeight(height)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
Prop("centerOffset") { (view: MarkerView, offset: [String: Double]) in
|
|
@@ -62,13 +62,13 @@ public class MarkerViewModule: Module {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
Prop("canShowCallout") { (view: MarkerView, canShow: Bool) in
|
|
65
|
-
view.
|
|
65
|
+
view.setCanShowCallout(canShow)
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
Prop("growAnimation") { (view: MarkerView, enabled: Bool) in
|
|
69
|
-
view.
|
|
69
|
+
view.setGrowAnimation(enabled)
|
|
70
70
|
}
|
|
71
|
-
Prop("cacheKey") { (view: MarkerView, key: String) in
|
|
71
|
+
Prop("cacheKey") { (view: MarkerView, key: String?) in
|
|
72
72
|
view.setCacheKey(key)
|
|
73
73
|
}
|
|
74
74
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-gaode-map",
|
|
3
|
-
"version": "2.2.30
|
|
3
|
+
"version": "2.2.30",
|
|
4
4
|
"description": "A full-featured AMap (Gaode Map) React Native component library built with Expo Modules, providing map display, location services, overlays, and more.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"@babel/runtime": "^7.25.7",
|
|
54
54
|
"@testing-library/react-native": "^13.3.3",
|
|
55
55
|
"@types/jest": "^29.5.14",
|
|
56
|
-
"@types/react": "~19.
|
|
57
|
-
"expo": "^
|
|
58
|
-
"expo-module-scripts": "^
|
|
56
|
+
"@types/react": "~19.2.10",
|
|
57
|
+
"expo": "^55.0.8",
|
|
58
|
+
"expo-module-scripts": "^55.0.2",
|
|
59
59
|
"jest": "~29.7.0",
|
|
60
|
-
"jest-expo": "
|
|
61
|
-
"react-native": "0.
|
|
60
|
+
"jest-expo": "~55.0.11",
|
|
61
|
+
"react-native": "0.83.2",
|
|
62
62
|
"typescript": "^5.9.3"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 一个轻量级的节流函数,用于限制函数调用的频率。
|
|
3
|
-
* 特别适用于处理高频事件,如地图移动、滚动等。
|
|
4
|
-
*
|
|
5
|
-
* @param func 需要节流的函数
|
|
6
|
-
* @param limit 时间间隔(毫秒)
|
|
7
|
-
* @returns 节流后的函数
|
|
8
|
-
*/
|
|
9
|
-
export declare function throttle<T extends (this: ThisParameterType<T>, ...args: Parameters<T>) => void>(func: T, limit: number): T;
|
|
10
|
-
//# sourceMappingURL=throttle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../src/utils/throttle.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,EAC7F,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,MAAM,GACZ,CAAC,CAUH"}
|
package/build/utils/throttle.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 一个轻量级的节流函数,用于限制函数调用的频率。
|
|
3
|
-
* 特别适用于处理高频事件,如地图移动、滚动等。
|
|
4
|
-
*
|
|
5
|
-
* @param func 需要节流的函数
|
|
6
|
-
* @param limit 时间间隔(毫秒)
|
|
7
|
-
* @returns 节流后的函数
|
|
8
|
-
*/
|
|
9
|
-
export function throttle(func, limit) {
|
|
10
|
-
let inThrottle = false;
|
|
11
|
-
return function (...args) {
|
|
12
|
-
if (!inThrottle) {
|
|
13
|
-
func.apply(this, args);
|
|
14
|
-
inThrottle = true;
|
|
15
|
-
setTimeout(() => (inThrottle = false), limit);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=throttle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throttle.js","sourceRoot":"","sources":["../../src/utils/throttle.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CACtB,IAAO,EACP,KAAa;IAEb,IAAI,UAAU,GAAG,KAAK,CAAC;IAEvB,OAAO,UAAsC,GAAG,IAAmB;QACjE,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACvB,UAAU,GAAG,IAAI,CAAC;YAClB,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,UAAU,GAAG,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;QAChD,CAAC;IACH,CAAM,CAAC;AACT,CAAC","sourcesContent":["\n/**\n * 一个轻量级的节流函数,用于限制函数调用的频率。\n * 特别适用于处理高频事件,如地图移动、滚动等。\n *\n * @param func 需要节流的函数\n * @param limit 时间间隔(毫秒)\n * @returns 节流后的函数\n */\nexport function throttle<T extends (this: ThisParameterType<T>, ...args: Parameters<T>) => void>(\n func: T,\n limit: number\n): T {\n let inThrottle = false;\n\n return function (this: ThisParameterType<T>, ...args: Parameters<T>) {\n if (!inThrottle) {\n func.apply(this, args);\n inThrottle = true;\n setTimeout(() => (inThrottle = false), limit);\n }\n } as T;\n}\n"]}
|