@maydon_tech/react-native-nitro-maps 0.1.1 → 0.1.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.
|
@@ -278,9 +278,9 @@ class MarkerIconFactory {
|
|
|
278
278
|
let width = CGFloat(config.width)
|
|
279
279
|
let height = CGFloat(config.height)
|
|
280
280
|
let cornerRadius = CGFloat(config.cornerRadius)
|
|
281
|
-
let borderWidth = CGFloat(config.borderWidth)
|
|
281
|
+
let borderWidth = CGFloat(config.borderWidth ?? 0)
|
|
282
282
|
|
|
283
|
-
let borderColorValue = config.borderColor.toMarkerColor()
|
|
283
|
+
let borderColorValue = (config.borderColor ?? .second(MarkerColor(r: 200, g: 200, b: 200, a: 255))).toMarkerColor()
|
|
284
284
|
let borderColor = UIColor(
|
|
285
285
|
red: CGFloat(borderColorValue.r) / 255,
|
|
286
286
|
green: CGFloat(borderColorValue.g) / 255,
|
|
@@ -93,7 +93,7 @@ class GoogleMapProvider: MapProviderProtocol {
|
|
|
93
93
|
didSet {
|
|
94
94
|
#if DEBUG
|
|
95
95
|
NSLog("[Clustering] didSet clusterConfig strategy=%@",
|
|
96
|
-
clusterConfig?.strategy
|
|
96
|
+
clusterConfig?.strategy?.stringValue ?? "nil")
|
|
97
97
|
#endif
|
|
98
98
|
updateClusterConfig()
|
|
99
99
|
}
|
|
@@ -14,12 +14,12 @@ extension ClusterConfig {
|
|
|
14
14
|
let rad: Double = existing?.radius ?? 80
|
|
15
15
|
let minSize: Double = existing?.minimumClusterSize ?? 2
|
|
16
16
|
let mz: Double = existing?.maxZoom ?? 20
|
|
17
|
-
let bg:
|
|
17
|
+
let bg: Variant_String_MarkerColor = existing?.backgroundColor
|
|
18
18
|
?? .second(MarkerColor(r: 0, g: 122, b: 255, a: 255))
|
|
19
|
-
let tc:
|
|
19
|
+
let tc: Variant_String_MarkerColor = existing?.textColor
|
|
20
20
|
?? .second(MarkerColor(r: 255, g: 255, b: 255, a: 255))
|
|
21
21
|
let bw: Double = existing?.borderWidth ?? 2
|
|
22
|
-
let bc:
|
|
22
|
+
let bc: Variant_String_MarkerColor = existing?.borderColor
|
|
23
23
|
?? .second(MarkerColor(r: 255, g: 255, b: 255, a: 255))
|
|
24
24
|
let anim: Bool = existing?.animatesClusters ?? true
|
|
25
25
|
let dur: Double = existing?.animationDuration ?? 0.3
|
|
@@ -68,9 +68,9 @@ final class ClusteringManager: ClusteringManagerProtocol {
|
|
|
68
68
|
didSet {
|
|
69
69
|
iconGenerator.updateConfig(clusterConfig)
|
|
70
70
|
if let config = clusterConfig {
|
|
71
|
-
engine.setClusterRadius(config.radius)
|
|
72
|
-
engine.setMinClusterSize(Int(config.minimumClusterSize))
|
|
73
|
-
engine.setMaxZoom(config.maxZoom)
|
|
71
|
+
engine.setClusterRadius(config.radius ?? 80)
|
|
72
|
+
engine.setMinClusterSize(Int(config.minimumClusterSize ?? 2))
|
|
73
|
+
engine.setMaxZoom(config.maxZoom ?? 20)
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -52,3 +52,50 @@ extension ColorValue {
|
|
|
52
52
|
)
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
// MARK: - Variant_String_MarkerColor Extension
|
|
57
|
+
// Nitrogen generates this as a separate type from ColorValue (same shape)
|
|
58
|
+
// when the field is optional in the struct. We mirror the same helpers.
|
|
59
|
+
extension Variant_String_MarkerColor {
|
|
60
|
+
func toMarkerColor() -> MarkerColor {
|
|
61
|
+
switch self {
|
|
62
|
+
case .first(let hexString):
|
|
63
|
+
return Variant_String_MarkerColor.parseHex(hexString)
|
|
64
|
+
case .second(let markerColor):
|
|
65
|
+
return markerColor
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
func toUIColor() -> UIColor {
|
|
70
|
+
let color = self.toMarkerColor()
|
|
71
|
+
return UIColor(
|
|
72
|
+
red: CGFloat(color.r) / 255,
|
|
73
|
+
green: CGFloat(color.g) / 255,
|
|
74
|
+
blue: CGFloat(color.b) / 255,
|
|
75
|
+
alpha: CGFloat(color.a) / 255
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private static func parseHex(_ hex: String) -> MarkerColor {
|
|
80
|
+
var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
81
|
+
hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "")
|
|
82
|
+
|
|
83
|
+
var rgb: UInt64 = 0
|
|
84
|
+
Scanner(string: hexSanitized).scanHexInt64(&rgb)
|
|
85
|
+
|
|
86
|
+
let r, g, b: Double
|
|
87
|
+
if hexSanitized.count == 6 {
|
|
88
|
+
r = Double((rgb & 0xFF0000) >> 16)
|
|
89
|
+
g = Double((rgb & 0x00FF00) >> 8)
|
|
90
|
+
b = Double(rgb & 0x0000FF)
|
|
91
|
+
} else if hexSanitized.count == 3 {
|
|
92
|
+
r = Double((rgb & 0xF00) >> 8) * 17
|
|
93
|
+
g = Double((rgb & 0x0F0) >> 4) * 17
|
|
94
|
+
b = Double(rgb & 0x00F) * 17
|
|
95
|
+
} else {
|
|
96
|
+
r = 0; g = 0; b = 0
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return MarkerColor(r: r, g: g, b: b, a: 255)
|
|
100
|
+
}
|
|
101
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maydon_tech/react-native-nitro-maps",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A high-performance React Native map library powered by Nitro Modules with support for Apple Maps, Google Maps, and Yandex Maps. Features native clustering, custom markers, and seamless cross-platform integration.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|