@lugg/maps 1.0.0-beta.1 → 1.0.0-beta.10
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 +3 -0
- package/android/src/main/java/com/luggmaps/LuggCalloutView.kt +7 -2
- package/android/src/main/java/com/luggmaps/LuggCalloutViewManager.kt +4 -3
- package/android/src/main/java/com/luggmaps/LuggCircleView.kt +85 -0
- package/android/src/main/java/com/luggmaps/LuggCircleViewManager.kt +79 -0
- package/android/src/main/java/com/luggmaps/LuggGroundOverlayView.kt +81 -0
- package/android/src/main/java/com/luggmaps/LuggGroundOverlayViewManager.kt +82 -0
- package/android/src/main/java/com/luggmaps/LuggMapView.kt +49 -0
- package/android/src/main/java/com/luggmaps/LuggMapViewManager.kt +31 -0
- package/android/src/main/java/com/luggmaps/LuggMarkerView.kt +26 -0
- package/android/src/main/java/com/luggmaps/LuggMarkerViewManager.kt +13 -0
- package/android/src/main/java/com/luggmaps/LuggPackage.kt +4 -1
- package/android/src/main/java/com/luggmaps/LuggPolylineView.kt +1 -22
- package/android/src/main/java/com/luggmaps/LuggTileOverlayView.kt +92 -0
- package/android/src/main/java/com/luggmaps/LuggTileOverlayViewManager.kt +80 -0
- package/android/src/main/java/com/luggmaps/core/GoogleMapProvider.kt +451 -17
- package/android/src/main/java/com/luggmaps/core/MapProviderDelegate.kt +14 -0
- package/android/src/main/java/com/luggmaps/core/PolylineAnimator.kt +12 -7
- package/android/src/main/java/com/luggmaps/events/CirclePressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/events/GroundOverlayPressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/events/TileOverlayPressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/extensions/ViewExtensions.kt +11 -0
- package/ios/LuggCalloutView.h +1 -1
- package/ios/LuggCalloutView.mm +21 -11
- package/ios/LuggCircleView.h +31 -0
- package/ios/LuggCircleView.mm +133 -0
- package/ios/LuggGroundOverlayView.h +30 -0
- package/ios/LuggGroundOverlayView.mm +125 -0
- package/ios/LuggMapView.mm +84 -2
- package/ios/LuggMarkerView.h +3 -0
- package/ios/LuggMarkerView.mm +23 -0
- package/ios/LuggTileOverlayView.h +31 -0
- package/ios/LuggTileOverlayView.mm +130 -0
- package/ios/core/AppleMapProvider.mm +697 -37
- package/ios/core/GMSPolylineAnimator.m +6 -3
- package/ios/core/GoogleMapProvider.mm +400 -22
- package/ios/core/MapProviderDelegate.h +20 -1
- package/ios/events/CirclePressEvent.h +20 -0
- package/ios/events/GroundOverlayPressEvent.h +20 -0
- package/ios/events/TileOverlayPressEvent.h +20 -0
- package/lib/module/MapProvider.web.js +4 -1
- package/lib/module/MapProvider.web.js.map +1 -1
- package/lib/module/MapView.js +12 -1
- package/lib/module/MapView.js.map +1 -1
- package/lib/module/MapView.web.js +21 -18
- package/lib/module/MapView.web.js.map +1 -1
- package/lib/module/components/Circle.js +46 -0
- package/lib/module/components/Circle.js.map +1 -0
- package/lib/module/components/Circle.types.js +4 -0
- package/lib/module/components/Circle.types.js.map +1 -0
- package/lib/module/components/Circle.web.js +79 -0
- package/lib/module/components/Circle.web.js.map +1 -0
- package/lib/module/components/GeoJson.js +3 -3
- package/lib/module/components/GeoJson.js.map +1 -1
- package/lib/module/components/GroundOverlay.js +45 -0
- package/lib/module/components/GroundOverlay.js.map +1 -0
- package/lib/module/components/GroundOverlay.types.js +4 -0
- package/lib/module/components/GroundOverlay.types.js.map +1 -0
- package/lib/module/components/GroundOverlay.web.js +77 -0
- package/lib/module/components/GroundOverlay.web.js.map +1 -0
- package/lib/module/components/Marker.js +22 -4
- package/lib/module/components/Marker.js.map +1 -1
- package/lib/module/components/Marker.web.js +23 -10
- package/lib/module/components/Marker.web.js.map +1 -1
- package/lib/module/components/Polygon.web.js +3 -3
- package/lib/module/components/Polygon.web.js.map +1 -1
- package/lib/module/components/Polyline.web.js +6 -12
- package/lib/module/components/Polyline.web.js.map +1 -1
- package/lib/module/components/TileOverlay.js +44 -0
- package/lib/module/components/TileOverlay.js.map +1 -0
- package/lib/module/components/TileOverlay.types.js +4 -0
- package/lib/module/components/TileOverlay.types.js.map +1 -0
- package/lib/module/components/TileOverlay.web.js +69 -0
- package/lib/module/components/TileOverlay.web.js.map +1 -0
- package/lib/module/components/index.js +3 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/index.web.js +3 -0
- package/lib/module/components/index.web.js.map +1 -1
- package/lib/module/fabric/LuggCalloutViewNativeComponent.ts +1 -1
- package/lib/module/fabric/LuggCircleViewNativeComponent.ts +25 -0
- package/lib/module/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
- package/lib/module/fabric/LuggMapViewNativeComponent.ts +13 -5
- package/lib/module/fabric/LuggMarkerViewNativeComponent.ts +14 -2
- package/lib/module/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +3 -0
- package/lib/module/index.web.js.map +1 -1
- package/lib/typescript/src/MapProvider.web.d.ts +3 -2
- package/lib/typescript/src/MapProvider.web.d.ts.map +1 -1
- package/lib/typescript/src/MapView.d.ts +1 -1
- package/lib/typescript/src/MapView.d.ts.map +1 -1
- package/lib/typescript/src/MapView.types.d.ts +36 -1
- package/lib/typescript/src/MapView.types.d.ts.map +1 -1
- package/lib/typescript/src/MapView.web.d.ts +1 -1
- package/lib/typescript/src/MapView.web.d.ts.map +1 -1
- package/lib/typescript/src/components/Circle.d.ts +10 -0
- package/lib/typescript/src/components/Circle.d.ts.map +1 -0
- package/lib/typescript/src/components/Circle.types.d.ts +33 -0
- package/lib/typescript/src/components/Circle.types.d.ts.map +1 -0
- package/lib/typescript/src/components/Circle.web.d.ts +3 -0
- package/lib/typescript/src/components/Circle.web.d.ts.map +1 -0
- package/lib/typescript/src/components/GeoJson.d.ts +2 -1
- package/lib/typescript/src/components/GeoJson.d.ts.map +1 -1
- package/lib/typescript/src/components/GroundOverlay.d.ts +10 -0
- package/lib/typescript/src/components/GroundOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/GroundOverlay.types.d.ts +35 -0
- package/lib/typescript/src/components/GroundOverlay.types.d.ts.map +1 -0
- package/lib/typescript/src/components/GroundOverlay.web.d.ts +3 -0
- package/lib/typescript/src/components/GroundOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/components/Marker.d.ts +6 -3
- package/lib/typescript/src/components/Marker.d.ts.map +1 -1
- package/lib/typescript/src/components/Marker.types.d.ts +18 -6
- package/lib/typescript/src/components/Marker.types.d.ts.map +1 -1
- package/lib/typescript/src/components/Marker.web.d.ts +3 -2
- package/lib/typescript/src/components/Marker.web.d.ts.map +1 -1
- package/lib/typescript/src/components/Polygon.web.d.ts +1 -1
- package/lib/typescript/src/components/Polygon.web.d.ts.map +1 -1
- package/lib/typescript/src/components/Polyline.web.d.ts +1 -1
- package/lib/typescript/src/components/Polyline.web.d.ts.map +1 -1
- package/lib/typescript/src/components/TileOverlay.d.ts +10 -0
- package/lib/typescript/src/components/TileOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/TileOverlay.types.d.ts +36 -0
- package/lib/typescript/src/components/TileOverlay.types.d.ts.map +1 -0
- package/lib/typescript/src/components/TileOverlay.web.d.ts +3 -0
- package/lib/typescript/src/components/TileOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +7 -1
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/components/index.web.d.ts +6 -0
- package/lib/typescript/src/components/index.web.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggCalloutViewNativeComponent.d.ts +1 -1
- package/lib/typescript/src/fabric/LuggCircleViewNativeComponent.d.ts +18 -0
- package/lib/typescript/src/fabric/LuggCircleViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/LuggGroundOverlayViewNativeComponent.d.ts +21 -0
- package/lib/typescript/src/fabric/LuggGroundOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts +10 -5
- package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts +8 -1
- package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts +21 -0
- package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +7 -1
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +0 -4
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/MapProvider.web.tsx +5 -3
- package/src/MapView.tsx +12 -1
- package/src/MapView.types.ts +118 -1
- package/src/MapView.web.tsx +378 -345
- package/src/components/Circle.tsx +52 -0
- package/src/components/Circle.types.ts +33 -0
- package/src/components/Circle.web.tsx +95 -0
- package/src/components/GeoJson.tsx +3 -3
- package/src/components/GroundOverlay.tsx +47 -0
- package/src/components/GroundOverlay.types.ts +36 -0
- package/src/components/GroundOverlay.web.tsx +81 -0
- package/src/components/Marker.tsx +32 -6
- package/src/components/Marker.types.ts +19 -6
- package/src/components/Marker.web.tsx +196 -150
- package/src/components/Polygon.web.tsx +93 -89
- package/src/components/Polyline.web.tsx +235 -235
- package/src/components/TileOverlay.tsx +44 -0
- package/src/components/TileOverlay.types.ts +37 -0
- package/src/components/TileOverlay.web.tsx +97 -0
- package/src/components/index.ts +10 -0
- package/src/components/index.web.ts +9 -0
- package/src/fabric/LuggCalloutViewNativeComponent.ts +1 -1
- package/src/fabric/LuggCircleViewNativeComponent.ts +25 -0
- package/src/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
- package/src/fabric/LuggMapViewNativeComponent.ts +13 -5
- package/src/fabric/LuggMarkerViewNativeComponent.ts +14 -2
- package/src/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
- package/src/index.ts +12 -1
- package/src/index.web.ts +15 -0
- package/src/types.ts +0 -5
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
package com.luggmaps.core
|
|
2
2
|
|
|
3
3
|
import android.view.View
|
|
4
|
+
import com.luggmaps.LuggCircleView
|
|
5
|
+
import com.luggmaps.LuggGroundOverlayView
|
|
4
6
|
import com.luggmaps.LuggMarkerView
|
|
5
7
|
import com.luggmaps.LuggPolygonView
|
|
6
8
|
import com.luggmaps.LuggPolylineView
|
|
9
|
+
import com.luggmaps.LuggTileOverlayView
|
|
7
10
|
|
|
8
11
|
data class EdgeInsets(val top: Int = 0, val left: Int = 0, val bottom: Int = 0, val right: Int = 0)
|
|
9
12
|
|
|
@@ -29,11 +32,16 @@ interface MapProvider {
|
|
|
29
32
|
fun setPitchEnabled(enabled: Boolean)
|
|
30
33
|
fun setUserLocationEnabled(enabled: Boolean)
|
|
31
34
|
fun setUserLocationButtonEnabled(enabled: Boolean)
|
|
35
|
+
fun setMapType(value: String)
|
|
32
36
|
fun setTheme(value: String)
|
|
33
37
|
fun setMinZoom(zoom: Double)
|
|
34
38
|
fun setMaxZoom(zoom: Double)
|
|
35
39
|
fun setEdgeInsets(edgeInsets: EdgeInsets)
|
|
36
40
|
fun setEdgeInsets(edgeInsets: EdgeInsets, duration: Int)
|
|
41
|
+
fun setInsetAdjustment(value: String)
|
|
42
|
+
fun setPoiEnabled(enabled: Boolean)
|
|
43
|
+
fun setPoiFilterMode(mode: String)
|
|
44
|
+
fun setPoiFilterCategories(categories: List<String>)
|
|
37
45
|
|
|
38
46
|
// Children
|
|
39
47
|
fun addMarkerView(markerView: LuggMarkerView)
|
|
@@ -42,6 +50,12 @@ interface MapProvider {
|
|
|
42
50
|
fun removePolylineView(polylineView: LuggPolylineView)
|
|
43
51
|
fun addPolygonView(polygonView: LuggPolygonView)
|
|
44
52
|
fun removePolygonView(polygonView: LuggPolygonView)
|
|
53
|
+
fun addCircleView(circleView: LuggCircleView)
|
|
54
|
+
fun removeCircleView(circleView: LuggCircleView)
|
|
55
|
+
fun addGroundOverlayView(groundOverlayView: LuggGroundOverlayView)
|
|
56
|
+
fun removeGroundOverlayView(groundOverlayView: LuggGroundOverlayView)
|
|
57
|
+
fun addTileOverlayView(tileOverlayView: LuggTileOverlayView)
|
|
58
|
+
fun removeTileOverlayView(tileOverlayView: LuggTileOverlayView)
|
|
45
59
|
|
|
46
60
|
// Lifecycle
|
|
47
61
|
fun pauseAnimations()
|
|
@@ -15,6 +15,7 @@ import kotlin.math.min
|
|
|
15
15
|
class PolylineAnimator {
|
|
16
16
|
companion object {
|
|
17
17
|
private const val MAX_ANIMATION_SPANS = 16
|
|
18
|
+
private const val MAX_GRADIENT_SPANS = 512
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
var polyline: Polyline? = null
|
|
@@ -209,8 +210,9 @@ class PolylineAnimator {
|
|
|
209
210
|
}
|
|
210
211
|
|
|
211
212
|
if (headDist <= tailDist) {
|
|
212
|
-
|
|
213
|
+
val point = coordinates.firstOrNull() ?: LatLng(0.0, 0.0)
|
|
213
214
|
poly.color = strokeColors.firstOrNull() ?: Color.BLACK
|
|
215
|
+
poly.points = listOf(point, point)
|
|
214
216
|
return
|
|
215
217
|
}
|
|
216
218
|
|
|
@@ -234,11 +236,12 @@ class PolylineAnimator {
|
|
|
234
236
|
|
|
235
237
|
if (reusablePoints.size < 2) return
|
|
236
238
|
|
|
239
|
+
// Clear spans before setting points to prevent IndexOutOfBoundsException
|
|
240
|
+
// when the new points list is shorter than what existing spans reference
|
|
241
|
+
poly.color = strokeColors.firstOrNull() ?: Color.BLACK
|
|
237
242
|
poly.points = ArrayList(reusablePoints)
|
|
238
243
|
|
|
239
|
-
if (strokeColors.size
|
|
240
|
-
poly.color = strokeColors.firstOrNull() ?: Color.BLACK
|
|
241
|
-
} else {
|
|
244
|
+
if (strokeColors.size > 1) {
|
|
242
245
|
val segmentCount = reusablePoints.size - 1
|
|
243
246
|
val spanCount = min(segmentCount, MAX_ANIMATION_SPANS)
|
|
244
247
|
val segmentsPerSpan = segmentCount.toDouble() / spanCount
|
|
@@ -255,10 +258,12 @@ class PolylineAnimator {
|
|
|
255
258
|
|
|
256
259
|
private fun createGradientSpans(): List<StyleSpan> {
|
|
257
260
|
val segmentCount = coordinates.size - 1
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
val spanCount = min(segmentCount, MAX_GRADIENT_SPANS)
|
|
262
|
+
val segmentsPerSpan = segmentCount.toDouble() / spanCount
|
|
263
|
+
return (0 until spanCount).map { i ->
|
|
264
|
+
val position = (i + 0.5f) / spanCount
|
|
260
265
|
val color = colorAtGradientPosition(position)
|
|
261
|
-
StyleSpan(StrokeStyle.colorBuilder(color).build())
|
|
266
|
+
StyleSpan(StrokeStyle.colorBuilder(color).build(), segmentsPerSpan)
|
|
262
267
|
}
|
|
263
268
|
}
|
|
264
269
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package com.luggmaps.events
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import com.facebook.react.bridge.Arguments
|
|
5
|
+
import com.facebook.react.uimanager.UIManagerHelper
|
|
6
|
+
import com.facebook.react.uimanager.events.Event
|
|
7
|
+
|
|
8
|
+
class CirclePressEvent(view: View) : Event<CirclePressEvent>(UIManagerHelper.getSurfaceId(view), view.id) {
|
|
9
|
+
override fun getEventName() = "topCirclePress"
|
|
10
|
+
|
|
11
|
+
override fun getEventData() = Arguments.createMap()
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package com.luggmaps.events
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import com.facebook.react.bridge.Arguments
|
|
5
|
+
import com.facebook.react.uimanager.UIManagerHelper
|
|
6
|
+
import com.facebook.react.uimanager.events.Event
|
|
7
|
+
|
|
8
|
+
class GroundOverlayPressEvent(view: View) : Event<GroundOverlayPressEvent>(UIManagerHelper.getSurfaceId(view), view.id) {
|
|
9
|
+
override fun getEventName() = "topGroundOverlayPress"
|
|
10
|
+
|
|
11
|
+
override fun getEventData() = Arguments.createMap()
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package com.luggmaps.events
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import com.facebook.react.bridge.Arguments
|
|
5
|
+
import com.facebook.react.uimanager.UIManagerHelper
|
|
6
|
+
import com.facebook.react.uimanager.events.Event
|
|
7
|
+
|
|
8
|
+
class TileOverlayPressEvent(view: View) : Event<TileOverlayPressEvent>(UIManagerHelper.getSurfaceId(view), view.id) {
|
|
9
|
+
override fun getEventName() = "topTileOverlayPress"
|
|
10
|
+
|
|
11
|
+
override fun getEventData() = Arguments.createMap()
|
|
12
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.luggmaps.extensions
|
|
2
2
|
|
|
3
3
|
import android.view.View
|
|
4
|
+
import android.view.ViewGroup
|
|
4
5
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
5
6
|
import com.facebook.react.uimanager.UIManagerHelper
|
|
6
7
|
import com.facebook.react.uimanager.events.Event
|
|
@@ -12,3 +13,13 @@ fun View.dispatchEvent(event: Event<*>) {
|
|
|
12
13
|
)
|
|
13
14
|
eventDispatcher?.dispatchEvent(event)
|
|
14
15
|
}
|
|
16
|
+
|
|
17
|
+
fun View.findViewByTag(tag: String): View? {
|
|
18
|
+
if (this.tag?.toString() == tag) return this
|
|
19
|
+
if (this !is ViewGroup) return null
|
|
20
|
+
for (i in 0 until childCount) {
|
|
21
|
+
val found = getChildAt(i).findViewByTag(tag)
|
|
22
|
+
if (found != null) return found
|
|
23
|
+
}
|
|
24
|
+
return null
|
|
25
|
+
}
|
package/ios/LuggCalloutView.h
CHANGED
|
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
13
13
|
@interface LuggCalloutView : RCTViewComponentView
|
|
14
14
|
|
|
15
15
|
@property(nonatomic, readonly) BOOL bubbled;
|
|
16
|
-
@property(nonatomic, readonly) CGPoint
|
|
16
|
+
@property(nonatomic, readonly) CGPoint offset;
|
|
17
17
|
@property(nonatomic, readonly) BOOL hasCustomContent;
|
|
18
18
|
@property(nonatomic, readonly) UIView *contentView;
|
|
19
19
|
@property(nonatomic, weak, nullable) id<LuggCalloutViewDelegate> delegate;
|
package/ios/LuggCalloutView.mm
CHANGED
|
@@ -43,7 +43,7 @@ using namespace facebook::react;
|
|
|
43
43
|
@implementation LuggCalloutView {
|
|
44
44
|
LuggCalloutContentView *_contentView;
|
|
45
45
|
BOOL _bubbled;
|
|
46
|
-
CGPoint
|
|
46
|
+
CGPoint _offset;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
@@ -58,7 +58,7 @@ using namespace facebook::react;
|
|
|
58
58
|
_props = defaultProps;
|
|
59
59
|
|
|
60
60
|
_bubbled = YES;
|
|
61
|
-
|
|
61
|
+
_offset = CGPointZero;
|
|
62
62
|
_contentView = [[LuggCalloutContentView alloc] init];
|
|
63
63
|
_contentView.backgroundColor = [UIColor clearColor];
|
|
64
64
|
|
|
@@ -74,29 +74,39 @@ using namespace facebook::react;
|
|
|
74
74
|
const auto &newViewProps =
|
|
75
75
|
*std::static_pointer_cast<LuggCalloutViewProps const>(props);
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
BOOL changed = NO;
|
|
78
|
+
|
|
79
|
+
if (_bubbled != newViewProps.bubbled) {
|
|
80
|
+
_bubbled = newViewProps.bubbled;
|
|
81
|
+
changed = YES;
|
|
82
|
+
}
|
|
78
83
|
|
|
79
84
|
if (oldProps) {
|
|
80
85
|
const auto &oldViewProps =
|
|
81
86
|
*std::static_pointer_cast<LuggCalloutViewProps const>(oldProps);
|
|
82
|
-
if (newViewProps.
|
|
83
|
-
newViewProps.
|
|
84
|
-
|
|
87
|
+
if (newViewProps.offset.x != oldViewProps.offset.x ||
|
|
88
|
+
newViewProps.offset.y != oldViewProps.offset.y) {
|
|
89
|
+
_offset = CGPointMake(newViewProps.offset.x, newViewProps.offset.y);
|
|
90
|
+
changed = YES;
|
|
85
91
|
}
|
|
86
|
-
} else if (newViewProps.
|
|
87
|
-
|
|
92
|
+
} else if (newViewProps.offset.x != 0 || newViewProps.offset.y != 0) {
|
|
93
|
+
_offset = CGPointMake(newViewProps.offset.x, newViewProps.offset.y);
|
|
94
|
+
changed = YES;
|
|
88
95
|
}
|
|
89
96
|
|
|
90
97
|
[super updateProps:props oldProps:oldProps];
|
|
91
|
-
|
|
98
|
+
|
|
99
|
+
if (changed) {
|
|
100
|
+
[_delegate calloutViewDidUpdate:self];
|
|
101
|
+
}
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
- (BOOL)bubbled {
|
|
95
105
|
return _bubbled;
|
|
96
106
|
}
|
|
97
107
|
|
|
98
|
-
- (CGPoint)
|
|
99
|
-
return
|
|
108
|
+
- (CGPoint)offset {
|
|
109
|
+
return _offset;
|
|
100
110
|
}
|
|
101
111
|
|
|
102
112
|
- (void)mountChildComponentView:
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#import <CoreLocation/CoreLocation.h>
|
|
2
|
+
#import <React/RCTViewComponentView.h>
|
|
3
|
+
#import <UIKit/UIKit.h>
|
|
4
|
+
|
|
5
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
6
|
+
|
|
7
|
+
@class LuggCircleView;
|
|
8
|
+
|
|
9
|
+
@protocol LuggCircleViewDelegate <NSObject>
|
|
10
|
+
@optional
|
|
11
|
+
- (void)circleViewDidUpdate:(LuggCircleView *)circleView;
|
|
12
|
+
@end
|
|
13
|
+
|
|
14
|
+
@interface LuggCircleView : RCTViewComponentView
|
|
15
|
+
|
|
16
|
+
@property(nonatomic, readonly) CLLocationCoordinate2D center;
|
|
17
|
+
@property(nonatomic, readonly) CLLocationDistance radius;
|
|
18
|
+
@property(nonatomic, readonly) UIColor *strokeColor;
|
|
19
|
+
@property(nonatomic, readonly) UIColor *fillColor;
|
|
20
|
+
@property(nonatomic, readonly) CGFloat strokeWidth;
|
|
21
|
+
@property(nonatomic, readonly) NSInteger zIndex;
|
|
22
|
+
@property(nonatomic, readonly) BOOL tappable;
|
|
23
|
+
@property(nonatomic, weak, nullable) id<LuggCircleViewDelegate> delegate;
|
|
24
|
+
@property(nonatomic, strong, nullable) NSObject *circle;
|
|
25
|
+
@property(nonatomic, weak, nullable) NSObject *renderer;
|
|
26
|
+
|
|
27
|
+
- (void)emitPressEvent;
|
|
28
|
+
|
|
29
|
+
@end
|
|
30
|
+
|
|
31
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
#import "LuggCircleView.h"
|
|
2
|
+
#import "events/CirclePressEvent.h"
|
|
3
|
+
|
|
4
|
+
#import <react/renderer/components/RNMapsSpec/ComponentDescriptors.h>
|
|
5
|
+
#import <react/renderer/components/RNMapsSpec/EventEmitters.h>
|
|
6
|
+
#import <react/renderer/components/RNMapsSpec/Props.h>
|
|
7
|
+
#import <react/renderer/components/RNMapsSpec/RCTComponentViewHelpers.h>
|
|
8
|
+
|
|
9
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
10
|
+
#import <React/RCTConversions.h>
|
|
11
|
+
|
|
12
|
+
using namespace facebook::react;
|
|
13
|
+
using namespace luggmaps::events;
|
|
14
|
+
|
|
15
|
+
@interface LuggCircleView () <RCTLuggCircleViewViewProtocol>
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation LuggCircleView {
|
|
19
|
+
CLLocationCoordinate2D _center;
|
|
20
|
+
CLLocationDistance _radius;
|
|
21
|
+
UIColor *_strokeColor;
|
|
22
|
+
UIColor *_fillColor;
|
|
23
|
+
CGFloat _strokeWidth;
|
|
24
|
+
NSInteger _zIndex;
|
|
25
|
+
BOOL _tappable;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
29
|
+
return concreteComponentDescriptorProvider<
|
|
30
|
+
LuggCircleViewComponentDescriptor>();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
|
34
|
+
if (self = [super initWithFrame:frame]) {
|
|
35
|
+
static const auto defaultProps =
|
|
36
|
+
std::make_shared<const LuggCircleViewProps>();
|
|
37
|
+
_props = defaultProps;
|
|
38
|
+
|
|
39
|
+
_center = CLLocationCoordinate2DMake(0, 0);
|
|
40
|
+
_radius = 0;
|
|
41
|
+
_strokeColor = [UIColor blackColor];
|
|
42
|
+
_fillColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3];
|
|
43
|
+
_strokeWidth = 1.0;
|
|
44
|
+
|
|
45
|
+
self.hidden = YES;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return self;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
- (void)updateProps:(Props::Shared const &)props
|
|
52
|
+
oldProps:(Props::Shared const &)oldProps {
|
|
53
|
+
[super updateProps:props oldProps:oldProps];
|
|
54
|
+
const auto &newViewProps =
|
|
55
|
+
*std::static_pointer_cast<LuggCircleViewProps const>(props);
|
|
56
|
+
|
|
57
|
+
_center = CLLocationCoordinate2DMake(newViewProps.center.latitude,
|
|
58
|
+
newViewProps.center.longitude);
|
|
59
|
+
_radius = newViewProps.radius;
|
|
60
|
+
|
|
61
|
+
if (newViewProps.strokeColor) {
|
|
62
|
+
UIColor *color = RCTUIColorFromSharedColor(newViewProps.strokeColor);
|
|
63
|
+
if (color) {
|
|
64
|
+
_strokeColor = color;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (newViewProps.fillColor) {
|
|
69
|
+
UIColor *color = RCTUIColorFromSharedColor(newViewProps.fillColor);
|
|
70
|
+
if (color) {
|
|
71
|
+
_fillColor = color;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_strokeWidth = newViewProps.strokeWidth > 0 ? newViewProps.strokeWidth : 1.0;
|
|
76
|
+
_zIndex = newViewProps.zIndex.value_or(0);
|
|
77
|
+
_tappable = newViewProps.tappable;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask {
|
|
81
|
+
[super finalizeUpdates:updateMask];
|
|
82
|
+
|
|
83
|
+
if (updateMask & RNComponentViewUpdateMaskProps) {
|
|
84
|
+
if ([self.delegate respondsToSelector:@selector(circleViewDidUpdate:)]) {
|
|
85
|
+
[self.delegate circleViewDidUpdate:self];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
- (CLLocationCoordinate2D)center {
|
|
91
|
+
return _center;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
- (CLLocationDistance)radius {
|
|
95
|
+
return _radius;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
- (UIColor *)strokeColor {
|
|
99
|
+
return _strokeColor;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
- (UIColor *)fillColor {
|
|
103
|
+
return _fillColor;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
- (CGFloat)strokeWidth {
|
|
107
|
+
return _strokeWidth;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
- (NSInteger)zIndex {
|
|
111
|
+
return _zIndex;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
- (BOOL)tappable {
|
|
115
|
+
return _tappable;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
- (void)emitPressEvent {
|
|
119
|
+
CirclePressEvent::emit<LuggCircleViewEventEmitter>(_eventEmitter);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
- (void)prepareForRecycle {
|
|
123
|
+
[super prepareForRecycle];
|
|
124
|
+
self.circle = nil;
|
|
125
|
+
self.renderer = nil;
|
|
126
|
+
self.delegate = nil;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
Class<RCTComponentViewProtocol> LuggCircleViewCls(void) {
|
|
130
|
+
return LuggCircleView.class;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#import <CoreLocation/CoreLocation.h>
|
|
2
|
+
#import <React/RCTViewComponentView.h>
|
|
3
|
+
#import <UIKit/UIKit.h>
|
|
4
|
+
|
|
5
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
6
|
+
|
|
7
|
+
@class LuggGroundOverlayView;
|
|
8
|
+
|
|
9
|
+
@protocol LuggGroundOverlayViewDelegate <NSObject>
|
|
10
|
+
@optional
|
|
11
|
+
- (void)groundOverlayViewDidUpdate:(LuggGroundOverlayView *)groundOverlayView;
|
|
12
|
+
@end
|
|
13
|
+
|
|
14
|
+
@interface LuggGroundOverlayView : RCTViewComponentView
|
|
15
|
+
|
|
16
|
+
@property(nonatomic, readonly) NSString *imageUri;
|
|
17
|
+
@property(nonatomic, readonly) CLLocationCoordinate2D northeast;
|
|
18
|
+
@property(nonatomic, readonly) CLLocationCoordinate2D southwest;
|
|
19
|
+
@property(nonatomic, readonly) CGFloat opacity;
|
|
20
|
+
@property(nonatomic, readonly) CGFloat bearing;
|
|
21
|
+
@property(nonatomic, readonly) NSInteger zIndex;
|
|
22
|
+
@property(nonatomic, readonly) BOOL tappable;
|
|
23
|
+
@property(nonatomic, weak, nullable) id<LuggGroundOverlayViewDelegate> delegate;
|
|
24
|
+
@property(nonatomic, strong, nullable) NSObject *overlay;
|
|
25
|
+
|
|
26
|
+
- (void)emitPressEvent;
|
|
27
|
+
|
|
28
|
+
@end
|
|
29
|
+
|
|
30
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#import "LuggGroundOverlayView.h"
|
|
2
|
+
#import "events/GroundOverlayPressEvent.h"
|
|
3
|
+
|
|
4
|
+
#import <react/renderer/components/RNMapsSpec/ComponentDescriptors.h>
|
|
5
|
+
#import <react/renderer/components/RNMapsSpec/EventEmitters.h>
|
|
6
|
+
#import <react/renderer/components/RNMapsSpec/Props.h>
|
|
7
|
+
#import <react/renderer/components/RNMapsSpec/RCTComponentViewHelpers.h>
|
|
8
|
+
|
|
9
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
10
|
+
|
|
11
|
+
using namespace facebook::react;
|
|
12
|
+
using namespace luggmaps::events;
|
|
13
|
+
|
|
14
|
+
@interface LuggGroundOverlayView () <RCTLuggGroundOverlayViewViewProtocol>
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
@implementation LuggGroundOverlayView {
|
|
18
|
+
NSString *_imageUri;
|
|
19
|
+
CLLocationCoordinate2D _northeast;
|
|
20
|
+
CLLocationCoordinate2D _southwest;
|
|
21
|
+
CGFloat _opacity;
|
|
22
|
+
CGFloat _bearing;
|
|
23
|
+
NSInteger _zIndex;
|
|
24
|
+
BOOL _tappable;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
28
|
+
return concreteComponentDescriptorProvider<
|
|
29
|
+
LuggGroundOverlayViewComponentDescriptor>();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
|
33
|
+
if (self = [super initWithFrame:frame]) {
|
|
34
|
+
static const auto defaultProps =
|
|
35
|
+
std::make_shared<const LuggGroundOverlayViewProps>();
|
|
36
|
+
_props = defaultProps;
|
|
37
|
+
|
|
38
|
+
_imageUri = @"";
|
|
39
|
+
_northeast = CLLocationCoordinate2DMake(0, 0);
|
|
40
|
+
_southwest = CLLocationCoordinate2DMake(0, 0);
|
|
41
|
+
_opacity = 1.0;
|
|
42
|
+
_bearing = 0.0;
|
|
43
|
+
|
|
44
|
+
self.hidden = YES;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return self;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
- (void)updateProps:(Props::Shared const &)props
|
|
51
|
+
oldProps:(Props::Shared const &)oldProps {
|
|
52
|
+
[super updateProps:props oldProps:oldProps];
|
|
53
|
+
const auto &newViewProps =
|
|
54
|
+
*std::static_pointer_cast<LuggGroundOverlayViewProps const>(props);
|
|
55
|
+
|
|
56
|
+
_imageUri = [NSString stringWithUTF8String:newViewProps.image.c_str()];
|
|
57
|
+
|
|
58
|
+
_northeast =
|
|
59
|
+
CLLocationCoordinate2DMake(newViewProps.bounds.northeast.latitude,
|
|
60
|
+
newViewProps.bounds.northeast.longitude);
|
|
61
|
+
_southwest =
|
|
62
|
+
CLLocationCoordinate2DMake(newViewProps.bounds.southwest.latitude,
|
|
63
|
+
newViewProps.bounds.southwest.longitude);
|
|
64
|
+
|
|
65
|
+
_opacity = newViewProps.opacity;
|
|
66
|
+
_bearing = newViewProps.bearing;
|
|
67
|
+
_zIndex = newViewProps.zIndex.value_or(0);
|
|
68
|
+
_tappable = newViewProps.tappable;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask {
|
|
72
|
+
[super finalizeUpdates:updateMask];
|
|
73
|
+
|
|
74
|
+
if (updateMask & RNComponentViewUpdateMaskProps) {
|
|
75
|
+
if ([self.delegate
|
|
76
|
+
respondsToSelector:@selector(groundOverlayViewDidUpdate:)]) {
|
|
77
|
+
[self.delegate groundOverlayViewDidUpdate:self];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
- (NSString *)imageUri {
|
|
83
|
+
return _imageUri;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
- (CLLocationCoordinate2D)northeast {
|
|
87
|
+
return _northeast;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
- (CLLocationCoordinate2D)southwest {
|
|
91
|
+
return _southwest;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
- (CGFloat)opacity {
|
|
95
|
+
return _opacity;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
- (CGFloat)bearing {
|
|
99
|
+
return _bearing;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
- (NSInteger)zIndex {
|
|
103
|
+
return _zIndex;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
- (BOOL)tappable {
|
|
107
|
+
return _tappable;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
- (void)emitPressEvent {
|
|
111
|
+
GroundOverlayPressEvent::emit<LuggGroundOverlayViewEventEmitter>(
|
|
112
|
+
_eventEmitter);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
- (void)prepareForRecycle {
|
|
116
|
+
[super prepareForRecycle];
|
|
117
|
+
self.overlay = nil;
|
|
118
|
+
self.delegate = nil;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
Class<RCTComponentViewProtocol> LuggGroundOverlayViewCls(void) {
|
|
122
|
+
return LuggGroundOverlayView.class;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@end
|