expo-gaode-map 1.0.1 → 1.0.3
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 +1 -0
- package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapModule.kt +17 -1
- package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapView.kt +52 -5
- package/android/src/main/java/expo/modules/gaodemap/managers/OverlayManager.kt +184 -6
- package/android/src/main/java/expo/modules/gaodemap/overlays/CircleView.kt +24 -51
- package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerView.kt +3 -0
- package/build/ExpoGaodeMap.types.d.ts.map +1 -1
- package/build/ExpoGaodeMap.types.js +0 -10
- package/build/ExpoGaodeMap.types.js.map +1 -1
- package/build/ExpoGaodeMapModule.d.ts.map +1 -1
- package/build/ExpoGaodeMapModule.js +0 -10
- package/build/ExpoGaodeMapModule.js.map +1 -1
- package/build/ExpoGaodeMapView.d.ts +39 -20
- package/build/ExpoGaodeMapView.d.ts.map +1 -1
- package/build/ExpoGaodeMapView.js +215 -31
- package/build/ExpoGaodeMapView.js.map +1 -1
- package/build/components/overlays/Circle.d.ts +0 -15
- package/build/components/overlays/Circle.d.ts.map +1 -1
- package/build/components/overlays/Circle.js +28 -46
- package/build/components/overlays/Circle.js.map +1 -1
- package/build/components/overlays/Cluster.d.ts +3 -15
- package/build/components/overlays/Cluster.d.ts.map +1 -1
- package/build/components/overlays/Cluster.js +3 -25
- package/build/components/overlays/Cluster.js.map +1 -1
- package/build/components/overlays/HeatMap.d.ts +3 -14
- package/build/components/overlays/HeatMap.d.ts.map +1 -1
- package/build/components/overlays/HeatMap.js +3 -24
- package/build/components/overlays/HeatMap.js.map +1 -1
- package/build/components/overlays/Marker.d.ts +2 -15
- package/build/components/overlays/Marker.d.ts.map +1 -1
- package/build/components/overlays/Marker.js +60 -46
- package/build/components/overlays/Marker.js.map +1 -1
- package/build/components/overlays/MultiPoint.d.ts +3 -14
- package/build/components/overlays/MultiPoint.d.ts.map +1 -1
- package/build/components/overlays/MultiPoint.js +3 -24
- package/build/components/overlays/MultiPoint.js.map +1 -1
- package/build/components/overlays/Polygon.d.ts +13 -16
- package/build/components/overlays/Polygon.d.ts.map +1 -1
- package/build/components/overlays/Polygon.js +41 -75
- package/build/components/overlays/Polygon.js.map +1 -1
- package/build/components/overlays/Polyline.d.ts +12 -14
- package/build/components/overlays/Polyline.d.ts.map +1 -1
- package/build/components/overlays/Polyline.js +34 -35
- package/build/components/overlays/Polyline.js.map +1 -1
- package/build/components/overlays/index.d.ts.map +1 -1
- package/build/components/overlays/index.js +0 -10
- package/build/components/overlays/index.js.map +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +0 -10
- package/build/index.js.map +1 -1
- package/build/modules/AMapLocation.d.ts +47 -10
- package/build/modules/AMapLocation.d.ts.map +1 -1
- package/build/modules/AMapLocation.js +48 -20
- package/build/modules/AMapLocation.js.map +1 -1
- package/build/modules/AMapPermissions.d.ts +3 -1
- package/build/modules/AMapPermissions.d.ts.map +1 -1
- package/build/modules/AMapPermissions.js +3 -11
- package/build/modules/AMapPermissions.js.map +1 -1
- package/build/modules/AMapSDK.d.ts +5 -4
- package/build/modules/AMapSDK.d.ts.map +1 -1
- package/build/modules/AMapSDK.js +5 -14
- package/build/modules/AMapSDK.js.map +1 -1
- package/build/modules/AMapView.d.ts.map +1 -1
- package/build/modules/AMapView.js +0 -8
- package/build/modules/AMapView.js.map +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/index.js +0 -10
- package/build/types/index.js.map +1 -1
- package/build/types/map-view.types.d.ts +30 -0
- package/build/types/map-view.types.d.ts.map +1 -1
- package/build/types/map-view.types.js.map +1 -1
- package/build/types/overlays.types.d.ts +25 -1
- package/build/types/overlays.types.d.ts.map +1 -1
- package/build/types/overlays.types.js.map +1 -1
- package/docs/API.md +40 -0
- package/docs/EXAMPLES.md +86 -2
- package/docs/RELEASE_GUIDE.md +178 -0
- package/expo-module.config.json +1 -1
- package/ios/ExpoGaodeMapModule.swift +42 -14
- package/ios/ExpoGaodeMapView.swift +210 -7
- package/ios/managers/OverlayManager.swift +78 -10
- package/ios/overlays/CircleView.swift +41 -12
- package/ios/overlays/MarkerView.swift +55 -3
- package/ios/overlays/PolygonView.swift +25 -5
- package/ios/overlays/PolylineView.swift +23 -4
- package/ios/utils/ColorParser.swift +0 -5
- package/package.json +1 -1
- package/src/ExpoGaodeMap.types.ts +1 -10
- package/src/ExpoGaodeMapModule.ts +1 -10
- package/src/ExpoGaodeMapView.tsx +257 -38
- package/src/components/overlays/Circle.tsx +32 -50
- package/src/components/overlays/Cluster.tsx +4 -26
- package/src/components/overlays/HeatMap.tsx +4 -25
- package/src/components/overlays/Marker.tsx +69 -52
- package/src/components/overlays/MultiPoint.tsx +4 -25
- package/src/components/overlays/Polygon.tsx +48 -78
- package/src/components/overlays/Polyline.tsx +41 -38
- package/src/components/overlays/index.ts +0 -11
- package/src/index.ts +0 -11
- package/src/modules/AMapLocation.ts +56 -20
- package/src/modules/AMapPermissions.ts +4 -11
- package/src/modules/AMapSDK.ts +7 -14
- package/src/modules/AMapView.ts +0 -8
- package/src/types/index.ts +1 -10
- package/src/types/map-view.types.ts +25 -0
- package/src/types/overlays.types.ts +30 -1
|
@@ -10,6 +10,9 @@ import MAMapKit
|
|
|
10
10
|
* - 响应属性变化并更新渲染
|
|
11
11
|
*/
|
|
12
12
|
class CircleView: ExpoView {
|
|
13
|
+
/// 事件派发器
|
|
14
|
+
let onPress = EventDispatcher()
|
|
15
|
+
|
|
13
16
|
/// 圆心坐标
|
|
14
17
|
var circleCenter: [String: Double] = [:]
|
|
15
18
|
/// 半径(米)
|
|
@@ -30,7 +33,6 @@ class CircleView: ExpoView {
|
|
|
30
33
|
|
|
31
34
|
required init(appContext: AppContext? = nil) {
|
|
32
35
|
super.init(appContext: appContext)
|
|
33
|
-
circle = MACircle()
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
/**
|
|
@@ -39,19 +41,39 @@ class CircleView: ExpoView {
|
|
|
39
41
|
*/
|
|
40
42
|
func setMap(_ map: MAMapView) {
|
|
41
43
|
self.mapView = map
|
|
42
|
-
|
|
43
|
-
map.add(circle)
|
|
44
|
-
}
|
|
44
|
+
updateCircle()
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* 更新圆形覆盖物
|
|
49
49
|
*/
|
|
50
50
|
private func updateCircle() {
|
|
51
|
-
guard let
|
|
52
|
-
let
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
guard let mapView = mapView,
|
|
52
|
+
let latitude = circleCenter["latitude"],
|
|
53
|
+
let longitude = circleCenter["longitude"],
|
|
54
|
+
radius > 0 else {
|
|
55
|
+
print("❌ CircleView.updateCircle: 条件不满足")
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
print("🔵 CircleView.updateCircle: center=(\(latitude),\(longitude)), radius=\(radius)")
|
|
60
|
+
print("🔵 CircleView.updateCircle: fillColor=\(String(describing: fillColor)), strokeColor=\(String(describing: strokeColor)), strokeWidth=\(strokeWidth)")
|
|
61
|
+
|
|
62
|
+
if circle == nil {
|
|
63
|
+
let coordinate = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
|
|
64
|
+
circle = MACircle(center: coordinate, radius: radius)
|
|
65
|
+
mapView.add(circle!)
|
|
66
|
+
print("🔵 CircleView.updateCircle: 创建新圆形")
|
|
67
|
+
} else {
|
|
68
|
+
circle?.coordinate = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
|
|
69
|
+
circle?.radius = radius
|
|
70
|
+
mapView.remove(circle!)
|
|
71
|
+
mapView.add(circle!)
|
|
72
|
+
print("🔵 CircleView.updateCircle: 更新现有圆形")
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
renderer = nil
|
|
76
|
+
print("🔵 CircleView.updateCircle: renderer 已清空")
|
|
55
77
|
}
|
|
56
78
|
|
|
57
79
|
/**
|
|
@@ -61,9 +83,15 @@ class CircleView: ExpoView {
|
|
|
61
83
|
func getRenderer() -> MAOverlayRenderer {
|
|
62
84
|
if renderer == nil, let circle = circle {
|
|
63
85
|
renderer = MACircleRenderer(circle: circle)
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
let parsedFillColor = ColorParser.parseColor(fillColor)
|
|
87
|
+
let parsedStrokeColor = ColorParser.parseColor(strokeColor)
|
|
88
|
+
renderer?.fillColor = parsedFillColor ?? UIColor.clear
|
|
89
|
+
renderer?.strokeColor = parsedStrokeColor ?? UIColor.clear
|
|
66
90
|
renderer?.lineWidth = CGFloat(strokeWidth)
|
|
91
|
+
print("🔵 CircleView.getRenderer: 创建新 renderer")
|
|
92
|
+
print("🔵 CircleView.getRenderer: fillColor=\(String(describing: parsedFillColor)), strokeColor=\(String(describing: parsedStrokeColor)), lineWidth=\(strokeWidth)")
|
|
93
|
+
} else {
|
|
94
|
+
print("🔵 CircleView.getRenderer: 使用缓存的 renderer")
|
|
67
95
|
}
|
|
68
96
|
return renderer!
|
|
69
97
|
}
|
|
@@ -74,7 +102,6 @@ class CircleView: ExpoView {
|
|
|
74
102
|
*/
|
|
75
103
|
func setCenter(_ center: [String: Double]) {
|
|
76
104
|
circleCenter = center
|
|
77
|
-
renderer = nil
|
|
78
105
|
updateCircle()
|
|
79
106
|
}
|
|
80
107
|
|
|
@@ -84,7 +111,6 @@ class CircleView: ExpoView {
|
|
|
84
111
|
*/
|
|
85
112
|
func setRadius(_ radius: Double) {
|
|
86
113
|
self.radius = radius
|
|
87
|
-
renderer = nil
|
|
88
114
|
updateCircle()
|
|
89
115
|
}
|
|
90
116
|
|
|
@@ -93,6 +119,7 @@ class CircleView: ExpoView {
|
|
|
93
119
|
* @param color 颜色值
|
|
94
120
|
*/
|
|
95
121
|
func setFillColor(_ color: Any?) {
|
|
122
|
+
print("🔵 CircleView.setFillColor: \(String(describing: color))")
|
|
96
123
|
fillColor = color
|
|
97
124
|
renderer = nil
|
|
98
125
|
updateCircle()
|
|
@@ -103,6 +130,7 @@ class CircleView: ExpoView {
|
|
|
103
130
|
* @param color 颜色值
|
|
104
131
|
*/
|
|
105
132
|
func setStrokeColor(_ color: Any?) {
|
|
133
|
+
print("🔵 CircleView.setStrokeColor: \(String(describing: color))")
|
|
106
134
|
strokeColor = color
|
|
107
135
|
renderer = nil
|
|
108
136
|
updateCircle()
|
|
@@ -113,6 +141,7 @@ class CircleView: ExpoView {
|
|
|
113
141
|
* @param width 宽度值
|
|
114
142
|
*/
|
|
115
143
|
func setStrokeWidth(_ width: Float) {
|
|
144
|
+
print("🔵 CircleView.setStrokeWidth: \(width)")
|
|
116
145
|
strokeWidth = width
|
|
117
146
|
renderer = nil
|
|
118
147
|
updateCircle()
|
|
@@ -3,13 +3,20 @@ import MAMapKit
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 标记点视图
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* 负责:
|
|
8
8
|
* - 在地图上显示标记点
|
|
9
9
|
* - 管理标记点属性(位置、标题、描述)
|
|
10
10
|
* - 支持拖拽功能
|
|
11
|
+
* - 支持自定义 children 视图
|
|
11
12
|
*/
|
|
12
13
|
class MarkerView: ExpoView {
|
|
14
|
+
// MARK: - 事件派发器
|
|
15
|
+
let onPress = EventDispatcher()
|
|
16
|
+
let onDragStart = EventDispatcher()
|
|
17
|
+
let onDrag = EventDispatcher()
|
|
18
|
+
let onDragEnd = EventDispatcher()
|
|
19
|
+
|
|
13
20
|
/// 标记点位置
|
|
14
21
|
var position: [String: Double] = [:]
|
|
15
22
|
/// 标题
|
|
@@ -18,11 +25,27 @@ class MarkerView: ExpoView {
|
|
|
18
25
|
var markerDescription: String = ""
|
|
19
26
|
/// 是否可拖拽
|
|
20
27
|
var draggable: Bool = false
|
|
28
|
+
/// 图标 URI
|
|
29
|
+
var iconUri: String?
|
|
30
|
+
/// 图标宽度
|
|
31
|
+
var iconWidth: Double = 40
|
|
32
|
+
/// 图标高度
|
|
33
|
+
var iconHeight: Double = 40
|
|
34
|
+
/// 中心偏移
|
|
35
|
+
var centerOffset: [String: Double]?
|
|
36
|
+
/// 是否显示动画
|
|
37
|
+
var animatesDrop: Bool = false
|
|
38
|
+
/// 大头针颜色
|
|
39
|
+
var pinColor: String = "red"
|
|
40
|
+
/// 是否显示气泡
|
|
41
|
+
var canShowCallout: Bool = true
|
|
21
42
|
|
|
22
43
|
/// 地图视图弱引用
|
|
23
44
|
private var mapView: MAMapView?
|
|
24
45
|
/// 标记点对象
|
|
25
|
-
|
|
46
|
+
var annotation: MAPointAnnotation?
|
|
47
|
+
/// 标记点视图
|
|
48
|
+
private var annotationView: MAAnnotationView?
|
|
26
49
|
|
|
27
50
|
required init(appContext: AppContext? = nil) {
|
|
28
51
|
super.init(appContext: appContext)
|
|
@@ -60,6 +83,9 @@ class MarkerView: ExpoView {
|
|
|
60
83
|
|
|
61
84
|
mapView.addAnnotation(annotation)
|
|
62
85
|
self.annotation = annotation
|
|
86
|
+
|
|
87
|
+
// 获取 annotationView
|
|
88
|
+
annotationView = mapView.view(for: annotation)
|
|
63
89
|
}
|
|
64
90
|
|
|
65
91
|
/**
|
|
@@ -95,7 +121,33 @@ class MarkerView: ExpoView {
|
|
|
95
121
|
*/
|
|
96
122
|
func setDraggable(_ draggable: Bool) {
|
|
97
123
|
self.draggable = draggable
|
|
98
|
-
|
|
124
|
+
updateAnnotation()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
func setIcon(_ source: [String: Any]?) {
|
|
128
|
+
if let dict = source {
|
|
129
|
+
// 处理 require() 返回的对象
|
|
130
|
+
if let uri = dict["uri"] as? String {
|
|
131
|
+
self.iconUri = uri
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
updateAnnotation()
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
func setCenterOffset(_ offset: [String: Double]) {
|
|
138
|
+
self.centerOffset = offset
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
func setAnimatesDrop(_ animate: Bool) {
|
|
142
|
+
self.animatesDrop = animate
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
func setPinColor(_ color: String) {
|
|
146
|
+
self.pinColor = color
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
func setCanShowCallout(_ show: Bool) {
|
|
150
|
+
self.canShowCallout = show
|
|
99
151
|
}
|
|
100
152
|
|
|
101
153
|
/**
|
|
@@ -43,17 +43,29 @@ class PolygonView: ExpoView {
|
|
|
43
43
|
* 更新多边形覆盖物
|
|
44
44
|
*/
|
|
45
45
|
private func updatePolygon() {
|
|
46
|
-
guard let mapView = mapView else {
|
|
46
|
+
guard let mapView = mapView else {
|
|
47
|
+
print("❌ PolygonView.updatePolygon: mapView 为空")
|
|
48
|
+
return
|
|
49
|
+
}
|
|
47
50
|
if let old = polygon { mapView.remove(old) }
|
|
48
51
|
|
|
49
52
|
var coords = points.compactMap { point -> CLLocationCoordinate2D? in
|
|
50
53
|
guard let lat = point["latitude"], let lng = point["longitude"] else { return nil }
|
|
51
54
|
return CLLocationCoordinate2D(latitude: lat, longitude: lng)
|
|
52
55
|
}
|
|
53
|
-
guard !coords.isEmpty else {
|
|
56
|
+
guard !coords.isEmpty else {
|
|
57
|
+
print("❌ PolygonView.updatePolygon: 点数组为空")
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
print("🔶 PolygonView.updatePolygon: points=\(coords.count)个点")
|
|
62
|
+
print("🔶 PolygonView.updatePolygon: fillColor=\(String(describing: fillColor)), strokeColor=\(String(describing: strokeColor)), strokeWidth=\(strokeWidth)")
|
|
54
63
|
|
|
55
64
|
polygon = MAPolygon(coordinates: &coords, count: UInt(coords.count))
|
|
56
65
|
mapView.add(polygon!)
|
|
66
|
+
|
|
67
|
+
renderer = nil
|
|
68
|
+
print("🔶 PolygonView.updatePolygon: renderer 已清空")
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
/**
|
|
@@ -63,9 +75,15 @@ class PolygonView: ExpoView {
|
|
|
63
75
|
func getRenderer() -> MAOverlayRenderer {
|
|
64
76
|
if renderer == nil, let polygon = polygon {
|
|
65
77
|
renderer = MAPolygonRenderer(polygon: polygon)
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
let parsedFillColor = ColorParser.parseColor(fillColor)
|
|
79
|
+
let parsedStrokeColor = ColorParser.parseColor(strokeColor)
|
|
80
|
+
renderer?.fillColor = parsedFillColor ?? UIColor.clear
|
|
81
|
+
renderer?.strokeColor = parsedStrokeColor ?? UIColor.clear
|
|
68
82
|
renderer?.lineWidth = CGFloat(strokeWidth)
|
|
83
|
+
print("🔶 PolygonView.getRenderer: 创建新 renderer")
|
|
84
|
+
print("🔶 PolygonView.getRenderer: fillColor=\(String(describing: parsedFillColor)), strokeColor=\(String(describing: parsedStrokeColor)), lineWidth=\(strokeWidth)")
|
|
85
|
+
} else {
|
|
86
|
+
print("🔶 PolygonView.getRenderer: 使用缓存的 renderer")
|
|
69
87
|
}
|
|
70
88
|
return renderer!
|
|
71
89
|
}
|
|
@@ -76,7 +94,6 @@ class PolygonView: ExpoView {
|
|
|
76
94
|
*/
|
|
77
95
|
func setPoints(_ points: [[String: Double]]) {
|
|
78
96
|
self.points = points
|
|
79
|
-
renderer = nil
|
|
80
97
|
updatePolygon()
|
|
81
98
|
}
|
|
82
99
|
|
|
@@ -85,6 +102,7 @@ class PolygonView: ExpoView {
|
|
|
85
102
|
* @param color 颜色值
|
|
86
103
|
*/
|
|
87
104
|
func setFillColor(_ color: Any?) {
|
|
105
|
+
print("🔶 PolygonView.setFillColor: \(String(describing: color))")
|
|
88
106
|
fillColor = color
|
|
89
107
|
renderer = nil
|
|
90
108
|
updatePolygon()
|
|
@@ -95,6 +113,7 @@ class PolygonView: ExpoView {
|
|
|
95
113
|
* @param color 颜色值
|
|
96
114
|
*/
|
|
97
115
|
func setStrokeColor(_ color: Any?) {
|
|
116
|
+
print("🔶 PolygonView.setStrokeColor: \(String(describing: color))")
|
|
98
117
|
strokeColor = color
|
|
99
118
|
renderer = nil
|
|
100
119
|
updatePolygon()
|
|
@@ -105,6 +124,7 @@ class PolygonView: ExpoView {
|
|
|
105
124
|
* @param width 宽度值
|
|
106
125
|
*/
|
|
107
126
|
func setStrokeWidth(_ width: Float) {
|
|
127
|
+
print("🔶 PolygonView.setStrokeWidth: \(width)")
|
|
108
128
|
strokeWidth = width
|
|
109
129
|
renderer = nil
|
|
110
130
|
updatePolygon()
|
|
@@ -43,17 +43,29 @@ class PolylineView: ExpoView {
|
|
|
43
43
|
* 更新折线覆盖物
|
|
44
44
|
*/
|
|
45
45
|
private func updatePolyline() {
|
|
46
|
-
guard let mapView = mapView else {
|
|
46
|
+
guard let mapView = mapView else {
|
|
47
|
+
print("❌ PolylineView.updatePolyline: mapView 为空")
|
|
48
|
+
return
|
|
49
|
+
}
|
|
47
50
|
if let old = polyline { mapView.remove(old) }
|
|
48
51
|
|
|
49
52
|
var coords = points.compactMap { point -> CLLocationCoordinate2D? in
|
|
50
53
|
guard let lat = point["latitude"], let lng = point["longitude"] else { return nil }
|
|
51
54
|
return CLLocationCoordinate2D(latitude: lat, longitude: lng)
|
|
52
55
|
}
|
|
53
|
-
guard !coords.isEmpty else {
|
|
56
|
+
guard !coords.isEmpty else {
|
|
57
|
+
print("❌ PolylineView.updatePolyline: 点数组为空")
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
print("🔷 PolylineView.updatePolyline: points=\(coords.count)个点")
|
|
62
|
+
print("🔷 PolylineView.updatePolyline: strokeColor=\(String(describing: strokeColor)), strokeWidth=\(strokeWidth), texture=\(String(describing: textureUrl))")
|
|
54
63
|
|
|
55
64
|
polyline = MAPolyline(coordinates: &coords, count: UInt(coords.count))
|
|
56
65
|
mapView.add(polyline!)
|
|
66
|
+
|
|
67
|
+
renderer = nil
|
|
68
|
+
print("🔷 PolylineView.updatePolyline: renderer 已清空")
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
/**
|
|
@@ -66,10 +78,15 @@ class PolylineView: ExpoView {
|
|
|
66
78
|
renderer?.lineWidth = CGFloat(strokeWidth)
|
|
67
79
|
|
|
68
80
|
if let url = textureUrl {
|
|
81
|
+
print("🔷 PolylineView.getRenderer: 加载纹理 \(url)")
|
|
69
82
|
loadTexture(url: url, renderer: renderer!)
|
|
70
83
|
} else {
|
|
71
|
-
|
|
84
|
+
let parsedColor = ColorParser.parseColor(strokeColor)
|
|
85
|
+
renderer?.strokeColor = parsedColor ?? UIColor.clear
|
|
86
|
+
print("🔷 PolylineView.getRenderer: 创建新 renderer, strokeColor=\(String(describing: parsedColor)), lineWidth=\(strokeWidth)")
|
|
72
87
|
}
|
|
88
|
+
} else {
|
|
89
|
+
print("🔷 PolylineView.getRenderer: 使用缓存的 renderer")
|
|
73
90
|
}
|
|
74
91
|
return renderer!
|
|
75
92
|
}
|
|
@@ -126,7 +143,6 @@ class PolylineView: ExpoView {
|
|
|
126
143
|
*/
|
|
127
144
|
func setPoints(_ points: [[String: Double]]) {
|
|
128
145
|
self.points = points
|
|
129
|
-
renderer = nil
|
|
130
146
|
updatePolyline()
|
|
131
147
|
}
|
|
132
148
|
|
|
@@ -135,6 +151,7 @@ class PolylineView: ExpoView {
|
|
|
135
151
|
* @param width 线宽值
|
|
136
152
|
*/
|
|
137
153
|
func setStrokeWidth(_ width: Float) {
|
|
154
|
+
print("🔷 PolylineView.setStrokeWidth: \(width)")
|
|
138
155
|
strokeWidth = width
|
|
139
156
|
renderer = nil
|
|
140
157
|
updatePolyline()
|
|
@@ -145,6 +162,7 @@ class PolylineView: ExpoView {
|
|
|
145
162
|
* @param color 颜色值
|
|
146
163
|
*/
|
|
147
164
|
func setStrokeColor(_ color: Any?) {
|
|
165
|
+
print("🔷 PolylineView.setStrokeColor: \(String(describing: color))")
|
|
148
166
|
strokeColor = color
|
|
149
167
|
renderer = nil
|
|
150
168
|
updatePolyline()
|
|
@@ -155,6 +173,7 @@ class PolylineView: ExpoView {
|
|
|
155
173
|
* @param url 图片 URL
|
|
156
174
|
*/
|
|
157
175
|
func setTexture(_ url: String?) {
|
|
176
|
+
print("🔷 PolylineView.setTexture: \(String(describing: url))")
|
|
158
177
|
textureUrl = url
|
|
159
178
|
renderer = nil
|
|
160
179
|
updatePolyline()
|
|
@@ -12,12 +12,10 @@ class ColorParser {
|
|
|
12
12
|
static func parseColor(_ colorValue: Any?) -> UIColor? {
|
|
13
13
|
guard let colorValue = colorValue else { return nil }
|
|
14
14
|
|
|
15
|
-
// 如果是数字类型
|
|
16
15
|
if let number = colorValue as? Int {
|
|
17
16
|
return UIColor(hex: number)
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
// 如果是字符串类型
|
|
21
19
|
if let string = colorValue as? String {
|
|
22
20
|
return parseColorString(string)
|
|
23
21
|
}
|
|
@@ -79,12 +77,10 @@ class ColorParser {
|
|
|
79
77
|
var hexNumber: UInt64 = 0
|
|
80
78
|
|
|
81
79
|
if scanner.scanHexInt64(&hexNumber) {
|
|
82
|
-
// 尝试 ARGB 格式(Android 风格)
|
|
83
80
|
let alphaARGB = CGFloat((hexNumber & 0xff000000) >> 24) / 255
|
|
84
81
|
let redARGB = CGFloat((hexNumber & 0x00ff0000) >> 16) / 255
|
|
85
82
|
let greenARGB = CGFloat((hexNumber & 0x0000ff00) >> 8) / 255
|
|
86
83
|
let blueARGB = CGFloat(hexNumber & 0x000000ff) / 255
|
|
87
|
-
|
|
88
84
|
return UIColor(red: redARGB, green: greenARGB, blue: blueARGB, alpha: alphaARGB)
|
|
89
85
|
}
|
|
90
86
|
}
|
|
@@ -98,7 +94,6 @@ class ColorParser {
|
|
|
98
94
|
let red = CGFloat((hexNumber & 0xff0000) >> 16) / 255
|
|
99
95
|
let green = CGFloat((hexNumber & 0x00ff00) >> 8) / 255
|
|
100
96
|
let blue = CGFloat(hexNumber & 0x0000ff) / 255
|
|
101
|
-
|
|
102
97
|
return UIColor(red: red, green: green, blue: blue, alpha: alpha)
|
|
103
98
|
}
|
|
104
99
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
|
|
3
|
-
* @Date : 2025-11-13 14:03:56
|
|
4
|
-
* @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
|
|
5
|
-
* @LastEditTime : 2025-11-13 14:30:00
|
|
6
|
-
* @FilePath : /expo-gaode-map/src/ExpoGaodeMap.types.ts
|
|
7
|
-
* @Description : 高德地图 Expo Module 主类型定义文件
|
|
8
|
-
*
|
|
9
|
-
* Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
|
|
10
|
-
*/
|
|
1
|
+
|
|
11
2
|
|
|
12
3
|
// 导出所有类型定义
|
|
13
4
|
export * from './types';
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
|
|
3
|
-
* @Date : 2025-11-13 14:03:56
|
|
4
|
-
* @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
|
|
5
|
-
* @LastEditTime : 2025-11-13 14:58:00
|
|
6
|
-
* @FilePath : /expo-gaode-map/src/ExpoGaodeMapModule.ts
|
|
7
|
-
* @Description :
|
|
8
|
-
*
|
|
9
|
-
* Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
|
|
10
|
-
*/
|
|
1
|
+
|
|
11
2
|
import { NativeModule, requireNativeModule } from 'expo';
|
|
12
3
|
import type { ExpoGaodeMapModuleEvents } from './ExpoGaodeMap.types';
|
|
13
4
|
|