react-native-google-maps-plus 1.7.0-dev.13 → 1.7.0-dev.15
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/build.gradle +1 -1
- package/android/gradle.properties +2 -1
- package/android/src/main/java/com/rngooglemapsplus/MapCircleBuilder.kt +2 -3
- package/android/src/main/java/com/rngooglemapsplus/MapMarkerBuilder.kt +24 -33
- package/android/src/main/java/com/rngooglemapsplus/MapPolygonBuilder.kt +6 -23
- package/android/src/main/java/com/rngooglemapsplus/MapPolylineBuilder.kt.kt +12 -39
- package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +1 -1
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNLineCapTypeExtension.kt +14 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNLineJoinTypeExtension.kt +12 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNMapCircleExtension.kt +7 -1
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNMarkerExtension.kt +54 -17
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNPolygonExtension.kt +31 -1
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNPolylineExtension.kt +6 -1
- package/ios/MapCircleBuilder.swift +2 -3
- package/ios/MapMarkerBuilder.swift +52 -49
- package/ios/MapPolygonBuilder.swift +6 -41
- package/ios/MapPolylineBuilder.swift +2 -10
- package/ios/RNGoogleMapsPlusView.swift +1 -1
- package/ios/extensions/RNCircle+Extension.swift +14 -5
- package/ios/extensions/RNLatLng+Extension.swift +11 -0
- package/ios/extensions/RNLineCapType+Extension.swift +10 -0
- package/ios/extensions/RNLineJoinType+Extension.swift +11 -0
- package/ios/extensions/RNMarker+Extension.swift +43 -12
- package/ios/extensions/RNPolygon+Extension.swift.swift +50 -21
- package/ios/extensions/RNPolyline+Extension.swift.swift +15 -26
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/src/types.d.ts +0 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JRNMarker.hpp +1 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNMarker.kt +2 -5
- package/nitrogen/generated/ios/swift/RNMarker.swift +1 -31
- package/nitrogen/generated/shared/c++/RNMarker.hpp +1 -5
- package/package.json +1 -1
- package/src/types.ts +0 -1
package/android/build.gradle
CHANGED
|
@@ -136,6 +136,6 @@ dependencies {
|
|
|
136
136
|
implementation "com.google.android.gms:play-services-base:${getExtOrDefault('googlePlayServicesBaseVersion')}"
|
|
137
137
|
implementation "com.google.android.gms:play-services-maps:${getExtOrDefault('googlePlayServicesMapsVersion')}"
|
|
138
138
|
implementation "com.google.android.gms:play-services-location:${getExtOrDefault('googlePlayServicesLocationVersion')}"
|
|
139
|
-
implementation
|
|
139
|
+
implementation "com.google.maps.android:android-maps-utils:${getExtOrDefault('mapsUtilsVersion')}"
|
|
140
140
|
implementation 'com.caverock:androidsvg-aar:1.4'
|
|
141
141
|
}
|
|
@@ -3,6 +3,7 @@ RNGoogleMapsPlus_minSdkVersion=26
|
|
|
3
3
|
RNGoogleMapsPlus_targetSdkVersion=36
|
|
4
4
|
RNGoogleMapsPlus_compileSdkVersion=36
|
|
5
5
|
RNGoogleMapsPlus_ndkVersion=27.1.12297006
|
|
6
|
-
RNGoogleMapsPlus_googlePlayServicesBaseVersion=18.
|
|
6
|
+
RNGoogleMapsPlus_googlePlayServicesBaseVersion=18.9.0
|
|
7
7
|
RNGoogleMapsPlus_googlePlayServicesMapsVersion=19.2.0
|
|
8
8
|
RNGoogleMapsPlus_googlePlayServicesLocationVersion=21.3.0
|
|
9
|
+
RNGoogleMapsPlus_mapsUtilsVersion=3.19.0
|
|
@@ -4,6 +4,7 @@ import android.graphics.Color
|
|
|
4
4
|
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
5
5
|
import com.google.android.gms.maps.model.Circle
|
|
6
6
|
import com.google.android.gms.maps.model.CircleOptions
|
|
7
|
+
import com.rngooglemapsplus.extensions.centerEquals
|
|
7
8
|
import com.rngooglemapsplus.extensions.onUi
|
|
8
9
|
import com.rngooglemapsplus.extensions.toColor
|
|
9
10
|
import com.rngooglemapsplus.extensions.toLatLng
|
|
@@ -25,9 +26,7 @@ class MapCircleBuilder {
|
|
|
25
26
|
next: RNCircle,
|
|
26
27
|
circle: Circle,
|
|
27
28
|
) = onUi {
|
|
28
|
-
if (prev.
|
|
29
|
-
prev.center.longitude != next.center.longitude
|
|
30
|
-
) {
|
|
29
|
+
if (!prev.centerEquals(next)) {
|
|
31
30
|
circle.center = next.center.toLatLng()
|
|
32
31
|
}
|
|
33
32
|
|
|
@@ -19,6 +19,10 @@ import com.google.android.gms.maps.model.BitmapDescriptor
|
|
|
19
19
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory
|
|
20
20
|
import com.google.android.gms.maps.model.Marker
|
|
21
21
|
import com.google.android.gms.maps.model.MarkerOptions
|
|
22
|
+
import com.rngooglemapsplus.extensions.anchorEquals
|
|
23
|
+
import com.rngooglemapsplus.extensions.coordinatesEquals
|
|
24
|
+
import com.rngooglemapsplus.extensions.infoWindowAnchorEquals
|
|
25
|
+
import com.rngooglemapsplus.extensions.markerInfoWindowStyleEquals
|
|
22
26
|
import com.rngooglemapsplus.extensions.markerStyleEquals
|
|
23
27
|
import com.rngooglemapsplus.extensions.onUi
|
|
24
28
|
import com.rngooglemapsplus.extensions.styleHash
|
|
@@ -169,51 +173,39 @@ class MapMarkerBuilder(
|
|
|
169
173
|
next: RNMarker,
|
|
170
174
|
marker: Marker,
|
|
171
175
|
) = onUi {
|
|
172
|
-
if (prev.
|
|
173
|
-
prev.coordinate.longitude != next.coordinate.longitude
|
|
174
|
-
) {
|
|
176
|
+
if (!prev.coordinatesEquals(next)) {
|
|
175
177
|
marker.position = next.coordinate.toLatLng()
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
if (!prev.markerStyleEquals(next)) {
|
|
179
|
-
buildIconAsync(
|
|
181
|
+
buildIconAsync(next) { icon ->
|
|
180
182
|
marker.setIcon(icon)
|
|
181
|
-
if (prev.
|
|
182
|
-
prev.infoWindowAnchor?.y != next.infoWindowAnchor?.y
|
|
183
|
-
) {
|
|
184
|
-
marker.setInfoWindowAnchor(
|
|
185
|
-
(next.infoWindowAnchor?.x ?: 0.5f).toFloat(),
|
|
186
|
-
(next.infoWindowAnchor?.y ?: 0f).toFloat(),
|
|
187
|
-
)
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (prev.anchor?.x != next.anchor?.x ||
|
|
191
|
-
prev.anchor?.y != next.anchor?.y
|
|
192
|
-
) {
|
|
183
|
+
if (!prev.anchorEquals(next)) {
|
|
193
184
|
marker.setAnchor(
|
|
194
185
|
(next.anchor?.x ?: 0.5f).toFloat(),
|
|
195
186
|
(next.anchor?.y ?: 1.0f).toFloat(),
|
|
196
187
|
)
|
|
197
188
|
}
|
|
189
|
+
if (!prev.infoWindowAnchorEquals(next)) {
|
|
190
|
+
marker.setInfoWindowAnchor(
|
|
191
|
+
(next.infoWindowAnchor?.x ?: 0.5f).toFloat(),
|
|
192
|
+
(next.infoWindowAnchor?.y ?: 0f).toFloat(),
|
|
193
|
+
)
|
|
194
|
+
}
|
|
198
195
|
}
|
|
199
196
|
} else {
|
|
200
|
-
if (prev.
|
|
201
|
-
prev.infoWindowAnchor?.y != next.infoWindowAnchor?.y
|
|
202
|
-
) {
|
|
203
|
-
marker.setInfoWindowAnchor(
|
|
204
|
-
(next.infoWindowAnchor?.x ?: 0.5f).toFloat(),
|
|
205
|
-
(next.infoWindowAnchor?.y ?: 0f).toFloat(),
|
|
206
|
-
)
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (prev.anchor?.x != next.anchor?.x ||
|
|
210
|
-
prev.anchor?.y != next.anchor?.y
|
|
211
|
-
) {
|
|
197
|
+
if (!prev.anchorEquals(next)) {
|
|
212
198
|
marker.setAnchor(
|
|
213
199
|
(next.anchor?.x ?: 0.5f).toFloat(),
|
|
214
200
|
(next.anchor?.y ?: 1.0f).toFloat(),
|
|
215
201
|
)
|
|
216
202
|
}
|
|
203
|
+
if (!prev.infoWindowAnchorEquals(next)) {
|
|
204
|
+
marker.setInfoWindowAnchor(
|
|
205
|
+
(next.infoWindowAnchor?.x ?: 0.5f).toFloat(),
|
|
206
|
+
(next.infoWindowAnchor?.y ?: 0f).toFloat(),
|
|
207
|
+
)
|
|
208
|
+
}
|
|
217
209
|
}
|
|
218
210
|
|
|
219
211
|
if (prev.title != next.title) {
|
|
@@ -244,17 +236,16 @@ class MapMarkerBuilder(
|
|
|
244
236
|
marker.zIndex = next.zIndex?.toFloat() ?: 0f
|
|
245
237
|
}
|
|
246
238
|
|
|
247
|
-
if (prev.
|
|
239
|
+
if (!prev.markerInfoWindowStyleEquals(next)) {
|
|
248
240
|
marker.tag = MarkerTag(id = next.id, iconSvg = next.infoWindowIconSvg)
|
|
249
241
|
}
|
|
250
242
|
}
|
|
251
243
|
|
|
252
244
|
fun buildIconAsync(
|
|
253
|
-
id: String,
|
|
254
245
|
m: RNMarker,
|
|
255
246
|
onReady: (BitmapDescriptor?) -> Unit,
|
|
256
247
|
) {
|
|
257
|
-
jobsById[id]?.cancel()
|
|
248
|
+
jobsById[m.id]?.cancel()
|
|
258
249
|
|
|
259
250
|
m.iconSvg ?: return onReady(null)
|
|
260
251
|
|
|
@@ -283,11 +274,11 @@ class MapMarkerBuilder(
|
|
|
283
274
|
iconCache.evictAll()
|
|
284
275
|
} catch (_: Throwable) {
|
|
285
276
|
} finally {
|
|
286
|
-
jobsById.remove(id)
|
|
277
|
+
jobsById.remove(m.id)
|
|
287
278
|
}
|
|
288
279
|
}
|
|
289
280
|
|
|
290
|
-
jobsById[id] = job
|
|
281
|
+
jobsById[m.id] = job
|
|
291
282
|
}
|
|
292
283
|
|
|
293
284
|
fun cancelIconJob(id: String) {
|
|
@@ -4,9 +4,12 @@ import android.graphics.Color
|
|
|
4
4
|
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
5
5
|
import com.google.android.gms.maps.model.Polygon
|
|
6
6
|
import com.google.android.gms.maps.model.PolygonOptions
|
|
7
|
+
import com.rngooglemapsplus.extensions.coordinatesEquals
|
|
8
|
+
import com.rngooglemapsplus.extensions.holesEquals
|
|
7
9
|
import com.rngooglemapsplus.extensions.onUi
|
|
8
10
|
import com.rngooglemapsplus.extensions.toColor
|
|
9
11
|
import com.rngooglemapsplus.extensions.toLatLng
|
|
12
|
+
import com.rngooglemapsplus.extensions.toMapsPolygonHoles
|
|
10
13
|
|
|
11
14
|
class MapPolygonBuilder {
|
|
12
15
|
fun build(poly: RNPolygon): PolygonOptions =
|
|
@@ -32,32 +35,12 @@ class MapPolygonBuilder {
|
|
|
32
35
|
next: RNPolygon,
|
|
33
36
|
poly: Polygon,
|
|
34
37
|
) = onUi {
|
|
35
|
-
|
|
36
|
-
prev.coordinates.size != next.coordinates.size ||
|
|
37
|
-
!prev.coordinates.zip(next.coordinates).all { (a, b) ->
|
|
38
|
-
a.latitude == b.latitude && a.longitude == b.longitude
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (coordsChanged) {
|
|
38
|
+
if (!prev.coordinatesEquals(next)) {
|
|
42
39
|
poly.points = next.coordinates.map { it.toLatLng() }
|
|
43
40
|
}
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
val holesChanged =
|
|
48
|
-
prevHoles.size != nextHoles.size ||
|
|
49
|
-
!prevHoles.zip(nextHoles).all { (ha, hb) ->
|
|
50
|
-
ha.coordinates.size == hb.coordinates.size &&
|
|
51
|
-
ha.coordinates.zip(hb.coordinates).all { (a, b) ->
|
|
52
|
-
a.latitude == b.latitude && a.longitude == b.longitude
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (holesChanged) {
|
|
57
|
-
poly.holes =
|
|
58
|
-
nextHoles.map { hole ->
|
|
59
|
-
hole.coordinates.map { it.toLatLng() }
|
|
60
|
-
}
|
|
42
|
+
if (!prev.holesEquals(next)) {
|
|
43
|
+
poly.holes = next.holes?.toMapsPolygonHoles() ?: emptyList()
|
|
61
44
|
}
|
|
62
45
|
|
|
63
46
|
if (prev.fillColor != next.fillColor) {
|
|
@@ -2,16 +2,14 @@ package com.rngooglemapsplus
|
|
|
2
2
|
|
|
3
3
|
import android.graphics.Color
|
|
4
4
|
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
5
|
-
import com.google.android.gms.maps.model.ButtCap
|
|
6
|
-
import com.google.android.gms.maps.model.Cap
|
|
7
|
-
import com.google.android.gms.maps.model.JointType
|
|
8
5
|
import com.google.android.gms.maps.model.Polyline
|
|
9
6
|
import com.google.android.gms.maps.model.PolylineOptions
|
|
10
|
-
import com.
|
|
11
|
-
import com.google.android.gms.maps.model.SquareCap
|
|
7
|
+
import com.rngooglemapsplus.extensions.coordinatesEquals
|
|
12
8
|
import com.rngooglemapsplus.extensions.onUi
|
|
13
9
|
import com.rngooglemapsplus.extensions.toColor
|
|
14
10
|
import com.rngooglemapsplus.extensions.toLatLng
|
|
11
|
+
import com.rngooglemapsplus.extensions.toMapJointType
|
|
12
|
+
import com.rngooglemapsplus.extensions.toMapLineCap
|
|
15
13
|
|
|
16
14
|
class MapPolylineBuilder {
|
|
17
15
|
fun build(pl: RNPolyline): PolylineOptions =
|
|
@@ -21,10 +19,10 @@ class MapPolylineBuilder {
|
|
|
21
19
|
}
|
|
22
20
|
pl.width?.let { width(it.dpToPx()) }
|
|
23
21
|
pl.lineCap?.let {
|
|
24
|
-
startCap(
|
|
25
|
-
endCap(
|
|
22
|
+
startCap(it.toMapLineCap())
|
|
23
|
+
endCap(it.toMapLineCap())
|
|
26
24
|
}
|
|
27
|
-
pl.lineJoin?.let { jointType(
|
|
25
|
+
pl.lineJoin?.let { jointType(it.toMapJointType()) }
|
|
28
26
|
pl.color?.let { color(it.toColor()) }
|
|
29
27
|
pl.geodesic?.let { geodesic(it) }
|
|
30
28
|
pl.pressable?.let { clickable(it) }
|
|
@@ -36,13 +34,7 @@ class MapPolylineBuilder {
|
|
|
36
34
|
next: RNPolyline,
|
|
37
35
|
polyline: Polyline,
|
|
38
36
|
) = onUi {
|
|
39
|
-
|
|
40
|
-
prev.coordinates.size != next.coordinates.size ||
|
|
41
|
-
!prev.coordinates.zip(next.coordinates).all { (a, b) ->
|
|
42
|
-
a.latitude == b.latitude && a.longitude == b.longitude
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (coordsChanged) {
|
|
37
|
+
if (!prev.coordinatesEquals(next)) {
|
|
46
38
|
polyline.points = next.coordinates.map { it.toLatLng() }
|
|
47
39
|
}
|
|
48
40
|
|
|
@@ -50,17 +42,13 @@ class MapPolylineBuilder {
|
|
|
50
42
|
polyline.width = next.width?.dpToPx() ?: 1f
|
|
51
43
|
}
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
polyline.startCap = newCap
|
|
57
|
-
polyline.endCap = newCap
|
|
45
|
+
if (prev.lineCap != next.lineCap) {
|
|
46
|
+
polyline.startCap = next.lineCap.toMapLineCap()
|
|
47
|
+
polyline.endCap = next.lineCap.toMapLineCap()
|
|
58
48
|
}
|
|
59
49
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (newJoin != prevJoin) {
|
|
63
|
-
polyline.jointType = newJoin
|
|
50
|
+
if (prev.lineJoin != next.lineJoin) {
|
|
51
|
+
polyline.jointType = next.lineJoin.toMapJointType()
|
|
64
52
|
}
|
|
65
53
|
|
|
66
54
|
if (prev.color != next.color) {
|
|
@@ -79,19 +67,4 @@ class MapPolylineBuilder {
|
|
|
79
67
|
polyline.zIndex = next.zIndex?.toFloat() ?: 0f
|
|
80
68
|
}
|
|
81
69
|
}
|
|
82
|
-
|
|
83
|
-
private fun mapLineCap(type: RNLineCapType?): Cap =
|
|
84
|
-
when (type) {
|
|
85
|
-
RNLineCapType.ROUND -> RoundCap()
|
|
86
|
-
RNLineCapType.SQUARE -> SquareCap()
|
|
87
|
-
else -> ButtCap()
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
private fun mapLineJoin(type: RNLineJoinType?): Int =
|
|
91
|
-
when (type) {
|
|
92
|
-
RNLineJoinType.ROUND -> JointType.ROUND
|
|
93
|
-
RNLineJoinType.BEVEL -> JointType.BEVEL
|
|
94
|
-
RNLineJoinType.MITER -> JointType.DEFAULT
|
|
95
|
-
null -> JointType.DEFAULT
|
|
96
|
-
}
|
|
97
70
|
}
|
|
@@ -151,7 +151,7 @@ class RNGoogleMapsPlusView(
|
|
|
151
151
|
val prev = prevById[id]
|
|
152
152
|
when {
|
|
153
153
|
prev == null ->
|
|
154
|
-
markerBuilder.buildIconAsync(
|
|
154
|
+
markerBuilder.buildIconAsync(next) { icon ->
|
|
155
155
|
view.addMarker(
|
|
156
156
|
id,
|
|
157
157
|
markerBuilder.build(next, icon),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package com.rngooglemapsplus.extensions
|
|
2
|
+
|
|
3
|
+
import com.google.android.gms.maps.model.ButtCap
|
|
4
|
+
import com.google.android.gms.maps.model.Cap
|
|
5
|
+
import com.google.android.gms.maps.model.RoundCap
|
|
6
|
+
import com.google.android.gms.maps.model.SquareCap
|
|
7
|
+
import com.rngooglemapsplus.RNLineCapType
|
|
8
|
+
|
|
9
|
+
fun RNLineCapType?.toMapLineCap(): Cap =
|
|
10
|
+
when (this) {
|
|
11
|
+
RNLineCapType.ROUND -> RoundCap()
|
|
12
|
+
RNLineCapType.SQUARE -> SquareCap()
|
|
13
|
+
else -> ButtCap()
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package com.rngooglemapsplus.extensions
|
|
2
|
+
|
|
3
|
+
import com.google.android.gms.maps.model.JointType
|
|
4
|
+
import com.rngooglemapsplus.RNLineJoinType
|
|
5
|
+
|
|
6
|
+
fun RNLineJoinType?.toMapJointType(): Int =
|
|
7
|
+
when (this) {
|
|
8
|
+
RNLineJoinType.ROUND -> JointType.ROUND
|
|
9
|
+
RNLineJoinType.BEVEL -> JointType.BEVEL
|
|
10
|
+
RNLineJoinType.MITER -> JointType.DEFAULT
|
|
11
|
+
null -> JointType.DEFAULT
|
|
12
|
+
}
|
|
@@ -3,12 +3,18 @@ package com.rngooglemapsplus.extensions
|
|
|
3
3
|
import com.rngooglemapsplus.RNCircle
|
|
4
4
|
|
|
5
5
|
fun RNCircle.circleEquals(b: RNCircle): Boolean {
|
|
6
|
+
if (!centerEquals(b)) return false
|
|
6
7
|
if (zIndex != b.zIndex) return false
|
|
7
8
|
if (pressable != b.pressable) return false
|
|
8
|
-
if (center != b.center) return false
|
|
9
9
|
if (radius != b.radius) return false
|
|
10
10
|
if (strokeWidth != b.strokeWidth) return false
|
|
11
11
|
if (strokeColor != b.strokeColor) return false
|
|
12
12
|
if (fillColor != b.fillColor) return false
|
|
13
13
|
return true
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
fun RNCircle.centerEquals(b: RNCircle): Boolean {
|
|
17
|
+
if (center.latitude != b.center.latitude) return false
|
|
18
|
+
if (center.longitude != b.center.longitude) return false
|
|
19
|
+
return true
|
|
20
|
+
}
|
|
@@ -2,24 +2,61 @@ package com.rngooglemapsplus.extensions
|
|
|
2
2
|
|
|
3
3
|
import com.rngooglemapsplus.RNMarker
|
|
4
4
|
|
|
5
|
-
fun RNMarker.markerEquals(b: RNMarker): Boolean
|
|
6
|
-
id
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
fun RNMarker.markerEquals(b: RNMarker): Boolean {
|
|
6
|
+
if (id != b.id) return false
|
|
7
|
+
if (zIndex != b.zIndex) return false
|
|
8
|
+
if (!coordinatesEquals(b)) return false
|
|
9
|
+
if (!anchorEquals(b)) return false
|
|
10
|
+
if (!infoWindowAnchorEquals(b)) return false
|
|
11
|
+
if (title != b.title) return false
|
|
12
|
+
if (snippet != b.snippet) return false
|
|
13
|
+
if (opacity != b.opacity) return false
|
|
14
|
+
if (flat != b.flat) return false
|
|
15
|
+
if (draggable != b.draggable) return false
|
|
16
|
+
if (rotation != b.rotation) return false
|
|
17
|
+
if (!markerInfoWindowStyleEquals(b)) return false
|
|
18
|
+
if (!markerStyleEquals(b)) return false
|
|
19
|
+
|
|
20
|
+
return true
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
fun RNMarker.coordinatesEquals(b: RNMarker): Boolean {
|
|
24
|
+
if (coordinate.latitude != b.coordinate.latitude) return false
|
|
25
|
+
if (coordinate.longitude != b.coordinate.longitude) return false
|
|
26
|
+
return true
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fun RNMarker.anchorEquals(b: RNMarker): Boolean {
|
|
30
|
+
if (anchor?.x != b.anchor?.x) return false
|
|
31
|
+
if (anchor?.y != b.anchor?.y) return false
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
fun RNMarker.infoWindowAnchorEquals(b: RNMarker): Boolean {
|
|
36
|
+
if (infoWindowAnchor?.x != b.infoWindowAnchor?.x) return false
|
|
37
|
+
if (infoWindowAnchor?.y != b.infoWindowAnchor?.y) return false
|
|
38
|
+
return true
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
fun RNMarker.markerInfoWindowStyleEquals(b: RNMarker): Boolean {
|
|
42
|
+
if (infoWindowIconSvg?.width != b.infoWindowIconSvg?.width) return false
|
|
43
|
+
if (infoWindowIconSvg?.height != b.infoWindowIconSvg?.height) return false
|
|
44
|
+
if (infoWindowIconSvg?.svgString != b.infoWindowIconSvg?.svgString) return false
|
|
45
|
+
|
|
46
|
+
return true
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
fun RNMarker.markerStyleEquals(b: RNMarker): Boolean {
|
|
50
|
+
if (iconSvg?.width != b.iconSvg?.width) return false
|
|
51
|
+
if (iconSvg?.height != b.iconSvg?.height) return false
|
|
52
|
+
if (iconSvg?.svgString != b.iconSvg?.svgString) return false
|
|
53
|
+
|
|
54
|
+
return true
|
|
55
|
+
}
|
|
21
56
|
|
|
22
57
|
fun RNMarker.styleHash(): Int =
|
|
23
58
|
arrayOf<Any?>(
|
|
24
|
-
iconSvg,
|
|
59
|
+
iconSvg?.width,
|
|
60
|
+
iconSvg?.height,
|
|
61
|
+
iconSvg?.svgString,
|
|
25
62
|
).contentHashCode()
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
package com.rngooglemapsplus.extensions
|
|
2
2
|
|
|
3
|
+
import com.google.android.gms.maps.model.LatLng
|
|
3
4
|
import com.rngooglemapsplus.RNPolygon
|
|
5
|
+
import com.rngooglemapsplus.RNPolygonHole
|
|
4
6
|
|
|
5
7
|
fun RNPolygon.polygonEquals(b: RNPolygon): Boolean {
|
|
6
8
|
if (zIndex != b.zIndex) return false
|
|
@@ -9,7 +11,12 @@ fun RNPolygon.polygonEquals(b: RNPolygon): Boolean {
|
|
|
9
11
|
if (fillColor != b.fillColor) return false
|
|
10
12
|
if (strokeColor != b.strokeColor) return false
|
|
11
13
|
if (geodesic != b.geodesic) return false
|
|
12
|
-
if (!
|
|
14
|
+
if (!coordinatesEquals(b)) return false
|
|
15
|
+
if (!holesEquals(b)) return false
|
|
16
|
+
return true
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
fun RNPolygon.coordinatesEquals(b: RNPolygon): Boolean {
|
|
13
20
|
val ac = coordinates
|
|
14
21
|
val bc = b.coordinates
|
|
15
22
|
if (ac.size != bc.size) return false
|
|
@@ -20,3 +27,26 @@ fun RNPolygon.polygonEquals(b: RNPolygon): Boolean {
|
|
|
20
27
|
}
|
|
21
28
|
return true
|
|
22
29
|
}
|
|
30
|
+
|
|
31
|
+
fun RNPolygon.holesEquals(b: RNPolygon): Boolean {
|
|
32
|
+
if (holes?.size != b.holes?.size) return false
|
|
33
|
+
if (holes != null && b.holes != null) {
|
|
34
|
+
for (i in holes.indices) {
|
|
35
|
+
val ah = holes[i]
|
|
36
|
+
val bh = b.holes[i]
|
|
37
|
+
|
|
38
|
+
if (ah.coordinates.size != bh.coordinates.size) return false
|
|
39
|
+
for (j in ah.coordinates.indices) {
|
|
40
|
+
val p = ah.coordinates[j]
|
|
41
|
+
val q = bh.coordinates[j]
|
|
42
|
+
if (p.latitude != q.latitude || p.longitude != q.longitude) return false
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return true
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
fun Array<RNPolygonHole>.toMapsPolygonHoles(): List<List<LatLng>> =
|
|
50
|
+
this.map { hole ->
|
|
51
|
+
hole.coordinates.map { it.toLatLng() }
|
|
52
|
+
}
|
|
@@ -5,11 +5,16 @@ import com.rngooglemapsplus.RNPolyline
|
|
|
5
5
|
fun RNPolyline.polylineEquals(b: RNPolyline): Boolean {
|
|
6
6
|
if (zIndex != b.zIndex) return false
|
|
7
7
|
if (pressable != b.pressable) return false
|
|
8
|
-
if (
|
|
8
|
+
if (width != b.width) return false
|
|
9
9
|
if (lineCap != b.lineCap) return false
|
|
10
10
|
if (lineJoin != b.lineJoin) return false
|
|
11
11
|
if (geodesic != b.geodesic) return false
|
|
12
12
|
if (color != b.color) return false
|
|
13
|
+
if (!coordinatesEquals(b)) return false
|
|
14
|
+
return true
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fun RNPolyline.coordinatesEquals(b: RNPolyline): Boolean {
|
|
13
18
|
val ac = coordinates
|
|
14
19
|
val bc = b.coordinates
|
|
15
20
|
if (ac.size != bc.size) return false
|
|
@@ -17,13 +17,12 @@ final class MapCircleBuilder {
|
|
|
17
17
|
|
|
18
18
|
@MainActor
|
|
19
19
|
func update(_ prev: RNCircle, _ next: RNCircle, _ c: GMSCircle) {
|
|
20
|
-
if prev.
|
|
21
|
-
|| prev.center.longitude != next.center.longitude {
|
|
20
|
+
if !prev.centerEquals(next) {
|
|
22
21
|
c.position = next.center.toCLLocationCoordinate2D()
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
if prev.radius != next.radius {
|
|
26
|
-
c.radius = next.radius
|
|
25
|
+
c.radius = next.radius
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
if prev.fillColor != next.fillColor {
|