@lugg/maps 1.0.0-beta.3 → 1.0.0-beta.5
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 +4 -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 +23 -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/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/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 +595 -17
- package/ios/core/GoogleMapProvider.mm +390 -28
- 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/MapView.js +11 -0
- package/lib/module/MapView.js.map +1 -1
- package/lib/module/MapView.web.js +3 -0
- 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/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 +20 -7
- package/lib/module/components/Marker.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 +9 -1
- 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/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.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/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/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 +6 -1
- 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/MapView.tsx +11 -0
- package/src/MapView.types.ts +85 -1
- package/src/MapView.web.tsx +11 -0
- package/src/components/Circle.tsx +52 -0
- package/src/components/Circle.types.ts +33 -0
- package/src/components/Circle.web.tsx +93 -0
- package/src/components/GroundOverlay.tsx +47 -0
- package/src/components/GroundOverlay.types.ts +36 -0
- package/src/components/GroundOverlay.web.tsx +85 -0
- package/src/components/Marker.tsx +32 -6
- package/src/components/Marker.types.ts +19 -6
- package/src/components/Marker.web.tsx +191 -148
- package/src/components/TileOverlay.tsx +44 -0
- package/src/components/TileOverlay.types.ts +37 -0
- package/src/components/TileOverlay.web.tsx +95 -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 +9 -1
- 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
package/README.md
CHANGED
|
@@ -116,7 +116,10 @@ import { MapView, Marker, Polyline, Polygon } from '@lugg/maps';
|
|
|
116
116
|
- [Marker](docs/MARKER.md) - Map markers with callout support
|
|
117
117
|
- [Polyline](docs/POLYLINE.md) - Draw lines on the map
|
|
118
118
|
- [Polygon](docs/POLYGON.md) - Draw filled shapes on the map
|
|
119
|
+
- [Circle](docs/CIRCLE.md) - Draw circular overlays on the map
|
|
119
120
|
- [GeoJson](docs/GEOJSON.md) - Render GeoJSON data on the map
|
|
121
|
+
- [GroundOverlay](docs/GROUND_OVERLAY.md) - Display images on the map
|
|
122
|
+
- [TileOverlay](docs/TILE_OVERLAY.md) - Display custom tile layers on the map
|
|
120
123
|
|
|
121
124
|
## Types
|
|
122
125
|
|
|
@@ -6,17 +6,18 @@ import android.graphics.Canvas
|
|
|
6
6
|
import android.view.View
|
|
7
7
|
import androidx.core.graphics.createBitmap
|
|
8
8
|
import androidx.core.view.isNotEmpty
|
|
9
|
+
import com.facebook.react.uimanager.PointerEvents
|
|
9
10
|
import com.facebook.react.views.view.ReactViewGroup
|
|
10
11
|
|
|
11
12
|
class LuggCalloutView(context: Context) : ReactViewGroup(context) {
|
|
12
13
|
val contentView: ReactViewGroup = ReactViewGroup(context)
|
|
13
14
|
var bubbled: Boolean = true
|
|
14
|
-
var
|
|
15
|
+
var offsetX: Float = 0f
|
|
15
16
|
set(value) {
|
|
16
17
|
field = value
|
|
17
18
|
onUpdate?.invoke()
|
|
18
19
|
}
|
|
19
|
-
var
|
|
20
|
+
var offsetY: Float = 0f
|
|
20
21
|
set(value) {
|
|
21
22
|
field = value
|
|
22
23
|
onUpdate?.invoke()
|
|
@@ -28,6 +29,7 @@ class LuggCalloutView(context: Context) : ReactViewGroup(context) {
|
|
|
28
29
|
|
|
29
30
|
init {
|
|
30
31
|
visibility = GONE
|
|
32
|
+
pointerEvents = PointerEvents.NONE
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
override fun addView(child: View, index: Int) {
|
|
@@ -2,6 +2,7 @@ package com.luggmaps
|
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.ReadableMap
|
|
4
4
|
import com.facebook.react.module.annotations.ReactModule
|
|
5
|
+
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
5
6
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
6
7
|
import com.facebook.react.uimanager.ViewGroupManager
|
|
7
8
|
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
@@ -22,9 +23,9 @@ class LuggCalloutViewManager :
|
|
|
22
23
|
view.bubbled = value
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
override fun
|
|
26
|
-
view.
|
|
27
|
-
view.
|
|
26
|
+
override fun setOffset(view: LuggCalloutView, value: ReadableMap?) {
|
|
27
|
+
view.offsetX = value?.getDouble("x")?.toFloat()?.dpToPx() ?: 0f
|
|
28
|
+
view.offsetY = value?.getDouble("y")?.toFloat()?.dpToPx() ?: 0f
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
override fun onDropViewInstance(view: LuggCalloutView) {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
package com.luggmaps
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.graphics.Color
|
|
5
|
+
import com.facebook.react.views.view.ReactViewGroup
|
|
6
|
+
import com.google.android.gms.maps.model.Circle
|
|
7
|
+
import com.google.android.gms.maps.model.LatLng
|
|
8
|
+
import com.luggmaps.events.CirclePressEvent
|
|
9
|
+
import com.luggmaps.extensions.dispatchEvent
|
|
10
|
+
|
|
11
|
+
interface LuggCircleViewDelegate {
|
|
12
|
+
fun circleViewDidUpdate(circleView: LuggCircleView)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
class LuggCircleView(context: Context) : ReactViewGroup(context) {
|
|
16
|
+
var center: LatLng = LatLng(0.0, 0.0)
|
|
17
|
+
private set
|
|
18
|
+
|
|
19
|
+
var radius: Double = 0.0
|
|
20
|
+
private set
|
|
21
|
+
|
|
22
|
+
var strokeColor: Int = Color.BLACK
|
|
23
|
+
private set
|
|
24
|
+
|
|
25
|
+
var fillColor: Int = Color.argb(77, 0, 0, 0)
|
|
26
|
+
private set
|
|
27
|
+
|
|
28
|
+
var strokeWidth: Float = 1f
|
|
29
|
+
private set
|
|
30
|
+
|
|
31
|
+
var zIndex: Float = 0f
|
|
32
|
+
private set
|
|
33
|
+
|
|
34
|
+
var tappable: Boolean = false
|
|
35
|
+
private set
|
|
36
|
+
|
|
37
|
+
var delegate: LuggCircleViewDelegate? = null
|
|
38
|
+
var circle: Circle? = null
|
|
39
|
+
|
|
40
|
+
init {
|
|
41
|
+
visibility = GONE
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
fun setCenter(value: LatLng) {
|
|
45
|
+
center = value
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
fun setRadius(value: Double) {
|
|
49
|
+
radius = value
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
fun setStrokeColor(color: Int) {
|
|
53
|
+
strokeColor = color
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
fun setFillColor(color: Int) {
|
|
57
|
+
fillColor = color
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
fun setStrokeWidth(width: Float) {
|
|
61
|
+
strokeWidth = width
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
fun setZIndex(value: Float) {
|
|
65
|
+
zIndex = value
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
fun setTappable(value: Boolean) {
|
|
69
|
+
tappable = value
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
fun emitPressEvent() {
|
|
73
|
+
dispatchEvent(CirclePressEvent(this))
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
fun onAfterUpdateTransaction() {
|
|
77
|
+
delegate?.circleViewDidUpdate(this)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
fun onDropViewInstance() {
|
|
81
|
+
delegate = null
|
|
82
|
+
circle?.remove()
|
|
83
|
+
circle = null
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
package com.luggmaps
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReadableMap
|
|
4
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
5
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewGroupManager
|
|
7
|
+
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
8
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
9
|
+
import com.facebook.react.viewmanagers.LuggCircleViewManagerDelegate
|
|
10
|
+
import com.facebook.react.viewmanagers.LuggCircleViewManagerInterface
|
|
11
|
+
import com.google.android.gms.maps.model.LatLng
|
|
12
|
+
|
|
13
|
+
@ReactModule(name = LuggCircleViewManager.NAME)
|
|
14
|
+
class LuggCircleViewManager :
|
|
15
|
+
ViewGroupManager<LuggCircleView>(),
|
|
16
|
+
LuggCircleViewManagerInterface<LuggCircleView> {
|
|
17
|
+
private val delegate: ViewManagerDelegate<LuggCircleView> = LuggCircleViewManagerDelegate(this)
|
|
18
|
+
|
|
19
|
+
override fun getDelegate(): ViewManagerDelegate<LuggCircleView> = delegate
|
|
20
|
+
override fun getName(): String = NAME
|
|
21
|
+
override fun createViewInstance(context: ThemedReactContext): LuggCircleView = LuggCircleView(context)
|
|
22
|
+
|
|
23
|
+
override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any> =
|
|
24
|
+
mapOf("topCirclePress" to mapOf("registrationName" to "onCirclePress"))
|
|
25
|
+
|
|
26
|
+
override fun onDropViewInstance(view: LuggCircleView) {
|
|
27
|
+
super.onDropViewInstance(view)
|
|
28
|
+
view.onDropViewInstance()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override fun onAfterUpdateTransaction(view: LuggCircleView) {
|
|
32
|
+
super.onAfterUpdateTransaction(view)
|
|
33
|
+
view.onAfterUpdateTransaction()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@ReactProp(name = "center")
|
|
37
|
+
override fun setCenter(view: LuggCircleView, value: ReadableMap?) {
|
|
38
|
+
value?.let { map ->
|
|
39
|
+
val lat = map.getDouble("latitude")
|
|
40
|
+
val lng = map.getDouble("longitude")
|
|
41
|
+
view.setCenter(LatLng(lat, lng))
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@ReactProp(name = "radius", defaultDouble = 0.0)
|
|
46
|
+
override fun setRadius(view: LuggCircleView, value: Double) {
|
|
47
|
+
view.setRadius(value)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@ReactProp(name = "strokeColor", customType = "Color")
|
|
51
|
+
override fun setStrokeColor(view: LuggCircleView, value: Int?) {
|
|
52
|
+
view.setStrokeColor(value ?: android.graphics.Color.BLACK)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@ReactProp(name = "fillColor", customType = "Color")
|
|
56
|
+
override fun setFillColor(view: LuggCircleView, value: Int?) {
|
|
57
|
+
view.setFillColor(value ?: android.graphics.Color.argb(77, 0, 0, 0))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@ReactProp(name = "strokeWidth", defaultDouble = 1.0)
|
|
61
|
+
override fun setStrokeWidth(view: LuggCircleView, value: Double) {
|
|
62
|
+
view.setStrokeWidth(value.toFloat())
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@ReactProp(name = "tappable")
|
|
66
|
+
override fun setTappable(view: LuggCircleView, value: Boolean) {
|
|
67
|
+
view.setTappable(value)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@ReactProp(name = "zIndex", defaultFloat = 0f)
|
|
71
|
+
override fun setZIndex(view: LuggCircleView, value: Float) {
|
|
72
|
+
super.setZIndex(view, value)
|
|
73
|
+
view.setZIndex(value)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
companion object {
|
|
77
|
+
const val NAME = "LuggCircleView"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
package com.luggmaps
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import com.facebook.react.views.view.ReactViewGroup
|
|
5
|
+
import com.google.android.gms.maps.model.GroundOverlay
|
|
6
|
+
import com.google.android.gms.maps.model.LatLng
|
|
7
|
+
import com.luggmaps.events.GroundOverlayPressEvent
|
|
8
|
+
import com.luggmaps.extensions.dispatchEvent
|
|
9
|
+
|
|
10
|
+
interface LuggGroundOverlayViewDelegate {
|
|
11
|
+
fun groundOverlayViewDidUpdate(groundOverlayView: LuggGroundOverlayView)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class LuggGroundOverlayView(context: Context) : ReactViewGroup(context) {
|
|
15
|
+
var imageUri: String = ""
|
|
16
|
+
private set
|
|
17
|
+
|
|
18
|
+
var northeast: LatLng = LatLng(0.0, 0.0)
|
|
19
|
+
private set
|
|
20
|
+
|
|
21
|
+
var southwest: LatLng = LatLng(0.0, 0.0)
|
|
22
|
+
private set
|
|
23
|
+
|
|
24
|
+
var overlayOpacity: Float = 1f
|
|
25
|
+
private set
|
|
26
|
+
|
|
27
|
+
var bearing: Float = 0f
|
|
28
|
+
private set
|
|
29
|
+
|
|
30
|
+
var zIndex: Float = 0f
|
|
31
|
+
private set
|
|
32
|
+
|
|
33
|
+
var tappable: Boolean = false
|
|
34
|
+
private set
|
|
35
|
+
|
|
36
|
+
var delegate: LuggGroundOverlayViewDelegate? = null
|
|
37
|
+
var groundOverlay: GroundOverlay? = null
|
|
38
|
+
|
|
39
|
+
init {
|
|
40
|
+
visibility = GONE
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
fun setImageUri(value: String) {
|
|
44
|
+
imageUri = value
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
fun setBounds(ne: LatLng, sw: LatLng) {
|
|
48
|
+
northeast = ne
|
|
49
|
+
southwest = sw
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
fun setOverlayOpacity(value: Float) {
|
|
53
|
+
overlayOpacity = value
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
fun setBearing(value: Float) {
|
|
57
|
+
bearing = value
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
fun setZIndex(value: Float) {
|
|
61
|
+
zIndex = value
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
fun setTappable(value: Boolean) {
|
|
65
|
+
tappable = value
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
fun emitPressEvent() {
|
|
69
|
+
dispatchEvent(GroundOverlayPressEvent(this))
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
fun onAfterUpdateTransaction() {
|
|
73
|
+
delegate?.groundOverlayViewDidUpdate(this)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
fun onDropViewInstance() {
|
|
77
|
+
delegate = null
|
|
78
|
+
groundOverlay?.remove()
|
|
79
|
+
groundOverlay = null
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
package com.luggmaps
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReadableMap
|
|
4
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
5
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewGroupManager
|
|
7
|
+
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
8
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
9
|
+
import com.facebook.react.viewmanagers.LuggGroundOverlayViewManagerDelegate
|
|
10
|
+
import com.facebook.react.viewmanagers.LuggGroundOverlayViewManagerInterface
|
|
11
|
+
import com.google.android.gms.maps.model.LatLng
|
|
12
|
+
|
|
13
|
+
@ReactModule(name = LuggGroundOverlayViewManager.NAME)
|
|
14
|
+
class LuggGroundOverlayViewManager :
|
|
15
|
+
ViewGroupManager<LuggGroundOverlayView>(),
|
|
16
|
+
LuggGroundOverlayViewManagerInterface<LuggGroundOverlayView> {
|
|
17
|
+
private val delegate: ViewManagerDelegate<LuggGroundOverlayView> = LuggGroundOverlayViewManagerDelegate(this)
|
|
18
|
+
|
|
19
|
+
override fun getDelegate(): ViewManagerDelegate<LuggGroundOverlayView> = delegate
|
|
20
|
+
override fun getName(): String = NAME
|
|
21
|
+
override fun createViewInstance(context: ThemedReactContext): LuggGroundOverlayView = LuggGroundOverlayView(context)
|
|
22
|
+
|
|
23
|
+
override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any> =
|
|
24
|
+
mapOf("topGroundOverlayPress" to mapOf("registrationName" to "onGroundOverlayPress"))
|
|
25
|
+
|
|
26
|
+
override fun onDropViewInstance(view: LuggGroundOverlayView) {
|
|
27
|
+
super.onDropViewInstance(view)
|
|
28
|
+
view.onDropViewInstance()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override fun onAfterUpdateTransaction(view: LuggGroundOverlayView) {
|
|
32
|
+
super.onAfterUpdateTransaction(view)
|
|
33
|
+
view.onAfterUpdateTransaction()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@ReactProp(name = "image")
|
|
37
|
+
override fun setImage(view: LuggGroundOverlayView, value: String?) {
|
|
38
|
+
view.setImageUri(value ?: "")
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@ReactProp(name = "bounds")
|
|
42
|
+
override fun setBounds(view: LuggGroundOverlayView, value: ReadableMap?) {
|
|
43
|
+
value?.let { map ->
|
|
44
|
+
val ne = map.getMap("northeast")
|
|
45
|
+
val sw = map.getMap("southwest")
|
|
46
|
+
val northeast = LatLng(
|
|
47
|
+
ne?.getDouble("latitude") ?: 0.0,
|
|
48
|
+
ne?.getDouble("longitude") ?: 0.0
|
|
49
|
+
)
|
|
50
|
+
val southwest = LatLng(
|
|
51
|
+
sw?.getDouble("latitude") ?: 0.0,
|
|
52
|
+
sw?.getDouble("longitude") ?: 0.0
|
|
53
|
+
)
|
|
54
|
+
view.setBounds(northeast, southwest)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@ReactProp(name = "opacity", defaultDouble = 1.0)
|
|
59
|
+
override fun setOpacity(view: LuggGroundOverlayView, value: Double) {
|
|
60
|
+
view.setOverlayOpacity(value.toFloat())
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@ReactProp(name = "bearing", defaultDouble = 0.0)
|
|
64
|
+
override fun setBearing(view: LuggGroundOverlayView, value: Double) {
|
|
65
|
+
view.setBearing(value.toFloat())
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@ReactProp(name = "tappable")
|
|
69
|
+
override fun setTappable(view: LuggGroundOverlayView, value: Boolean) {
|
|
70
|
+
view.setTappable(value)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@ReactProp(name = "zIndex", defaultFloat = 0f)
|
|
74
|
+
override fun setZIndex(view: LuggGroundOverlayView, value: Float) {
|
|
75
|
+
super.setZIndex(view, value)
|
|
76
|
+
view.setZIndex(value)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
companion object {
|
|
80
|
+
const val NAME = "LuggGroundOverlayView"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -58,6 +58,7 @@ class LuggMapView(private val reactContext: ThemedReactContext) :
|
|
|
58
58
|
private var initialLatitude: Double = 37.78
|
|
59
59
|
private var initialLongitude: Double = -122.43
|
|
60
60
|
private var initialZoom: Float = 14f
|
|
61
|
+
private var mapType: String = "standard"
|
|
61
62
|
private var theme: String = "system"
|
|
62
63
|
private var zoomEnabled: Boolean = true
|
|
63
64
|
private var scrollEnabled: Boolean = true
|
|
@@ -65,9 +66,13 @@ class LuggMapView(private val reactContext: ThemedReactContext) :
|
|
|
65
66
|
private var pitchEnabled: Boolean = true
|
|
66
67
|
private var userLocationEnabled: Boolean = false
|
|
67
68
|
private var userLocationButtonEnabled: Boolean = false
|
|
69
|
+
private var poiEnabled: Boolean = true
|
|
70
|
+
private var poiFilterMode: String = "including"
|
|
71
|
+
private var poiFilterCategories: List<String> = emptyList()
|
|
68
72
|
private var minZoom: Double? = null
|
|
69
73
|
private var maxZoom: Double? = null
|
|
70
74
|
private var edgeInsets: EdgeInsets = EdgeInsets()
|
|
75
|
+
private var insetAdjustment: String = "never"
|
|
71
76
|
|
|
72
77
|
// region View Lifecycle
|
|
73
78
|
|
|
@@ -78,6 +83,9 @@ class LuggMapView(private val reactContext: ThemedReactContext) :
|
|
|
78
83
|
is LuggMarkerView -> provider?.addMarkerView(child)
|
|
79
84
|
is LuggPolylineView -> provider?.addPolylineView(child)
|
|
80
85
|
is LuggPolygonView -> provider?.addPolygonView(child)
|
|
86
|
+
is LuggCircleView -> provider?.addCircleView(child)
|
|
87
|
+
is LuggGroundOverlayView -> provider?.addGroundOverlayView(child)
|
|
88
|
+
is LuggTileOverlayView -> provider?.addTileOverlayView(child)
|
|
81
89
|
}
|
|
82
90
|
}
|
|
83
91
|
|
|
@@ -87,6 +95,9 @@ class LuggMapView(private val reactContext: ThemedReactContext) :
|
|
|
87
95
|
is LuggMarkerView -> provider?.removeMarkerView(view)
|
|
88
96
|
is LuggPolylineView -> provider?.removePolylineView(view)
|
|
89
97
|
is LuggPolygonView -> provider?.removePolygonView(view)
|
|
98
|
+
is LuggCircleView -> provider?.removeCircleView(view)
|
|
99
|
+
is LuggGroundOverlayView -> provider?.removeGroundOverlayView(view)
|
|
100
|
+
is LuggTileOverlayView -> provider?.removeTileOverlayView(view)
|
|
90
101
|
}
|
|
91
102
|
super.removeViewAt(index)
|
|
92
103
|
}
|
|
@@ -135,6 +146,9 @@ class LuggMapView(private val reactContext: ThemedReactContext) :
|
|
|
135
146
|
is LuggMarkerView -> google.addMarkerView(child)
|
|
136
147
|
is LuggPolylineView -> google.addPolylineView(child)
|
|
137
148
|
is LuggPolygonView -> google.addPolygonView(child)
|
|
149
|
+
is LuggCircleView -> google.addCircleView(child)
|
|
150
|
+
is LuggGroundOverlayView -> google.addGroundOverlayView(child)
|
|
151
|
+
is LuggTileOverlayView -> google.addTileOverlayView(child)
|
|
138
152
|
}
|
|
139
153
|
}
|
|
140
154
|
}
|
|
@@ -174,10 +188,15 @@ class LuggMapView(private val reactContext: ThemedReactContext) :
|
|
|
174
188
|
provider?.setPitchEnabled(pitchEnabled)
|
|
175
189
|
provider?.setUserLocationEnabled(userLocationEnabled)
|
|
176
190
|
provider?.setUserLocationButtonEnabled(userLocationButtonEnabled)
|
|
191
|
+
provider?.setMapType(mapType)
|
|
177
192
|
provider?.setTheme(theme)
|
|
178
193
|
minZoom?.let { provider?.setMinZoom(it) }
|
|
179
194
|
maxZoom?.let { provider?.setMaxZoom(it) }
|
|
180
195
|
provider?.setEdgeInsets(edgeInsets)
|
|
196
|
+
provider?.setInsetAdjustment(insetAdjustment)
|
|
197
|
+
provider?.setPoiEnabled(poiEnabled)
|
|
198
|
+
provider?.setPoiFilterMode(poiFilterMode)
|
|
199
|
+
provider?.setPoiFilterCategories(poiFilterCategories)
|
|
181
200
|
}
|
|
182
201
|
|
|
183
202
|
fun setProvider(value: String?) {
|
|
@@ -248,12 +267,42 @@ class LuggMapView(private val reactContext: ThemedReactContext) :
|
|
|
248
267
|
provider?.setMaxZoom(zoom)
|
|
249
268
|
}
|
|
250
269
|
|
|
270
|
+
fun setMapType(value: String) {
|
|
271
|
+
if (mapType == value) return
|
|
272
|
+
mapType = value
|
|
273
|
+
provider?.setMapType(value)
|
|
274
|
+
}
|
|
275
|
+
|
|
251
276
|
fun setTheme(value: String) {
|
|
252
277
|
if (theme == value) return
|
|
253
278
|
theme = value
|
|
254
279
|
provider?.setTheme(value)
|
|
255
280
|
}
|
|
256
281
|
|
|
282
|
+
fun setPoiEnabled(enabled: Boolean) {
|
|
283
|
+
if (poiEnabled == enabled) return
|
|
284
|
+
poiEnabled = enabled
|
|
285
|
+
provider?.setPoiEnabled(enabled)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
fun setPoiFilterMode(value: String) {
|
|
289
|
+
if (poiFilterMode == value) return
|
|
290
|
+
poiFilterMode = value
|
|
291
|
+
provider?.setPoiFilterMode(value)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
fun setPoiFilterCategories(categories: List<String>) {
|
|
295
|
+
if (poiFilterCategories == categories) return
|
|
296
|
+
poiFilterCategories = categories
|
|
297
|
+
provider?.setPoiFilterCategories(categories)
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
fun setInsetAdjustment(value: String) {
|
|
301
|
+
if (insetAdjustment == value) return
|
|
302
|
+
insetAdjustment = value
|
|
303
|
+
provider?.setInsetAdjustment(value)
|
|
304
|
+
}
|
|
305
|
+
|
|
257
306
|
fun setEdgeInsets(
|
|
258
307
|
top: Int,
|
|
259
308
|
left: Int,
|
|
@@ -152,11 +152,42 @@ class LuggMapViewManager :
|
|
|
152
152
|
view.setMaxZoom(value)
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
@ReactProp(name = "mapType")
|
|
156
|
+
override fun setMapType(view: LuggMapView, value: String?) {
|
|
157
|
+
view.setMapType(value ?: "standard")
|
|
158
|
+
}
|
|
159
|
+
|
|
155
160
|
@ReactProp(name = "theme")
|
|
156
161
|
override fun setTheme(view: LuggMapView, value: String?) {
|
|
157
162
|
view.setTheme(value ?: "system")
|
|
158
163
|
}
|
|
159
164
|
|
|
165
|
+
@ReactProp(name = "poiEnabled", defaultBoolean = true)
|
|
166
|
+
override fun setPoiEnabled(view: LuggMapView, value: Boolean) {
|
|
167
|
+
view.setPoiEnabled(value)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@ReactProp(name = "poiFilterMode")
|
|
171
|
+
override fun setPoiFilterMode(view: LuggMapView, value: String?) {
|
|
172
|
+
view.setPoiFilterMode(value ?: "including")
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@ReactProp(name = "poiFilterCategories")
|
|
176
|
+
override fun setPoiFilterCategories(view: LuggMapView, value: ReadableArray?) {
|
|
177
|
+
val categories = mutableListOf<String>()
|
|
178
|
+
value?.let { array ->
|
|
179
|
+
for (i in 0 until array.size()) {
|
|
180
|
+
array.getString(i)?.let { categories.add(it) }
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
view.setPoiFilterCategories(categories)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@ReactProp(name = "insetAdjustment")
|
|
187
|
+
override fun setInsetAdjustment(view: LuggMapView, value: String?) {
|
|
188
|
+
view.setInsetAdjustment(value ?: "never")
|
|
189
|
+
}
|
|
190
|
+
|
|
160
191
|
@ReactProp(name = "edgeInsets")
|
|
161
192
|
override fun setEdgeInsets(view: LuggMapView, value: ReadableMap?) {
|
|
162
193
|
value?.let {
|
|
@@ -16,6 +16,8 @@ import com.luggmaps.extensions.dispatchEvent
|
|
|
16
16
|
interface LuggMarkerViewDelegate {
|
|
17
17
|
fun markerViewDidUpdate(markerView: LuggMarkerView)
|
|
18
18
|
fun markerViewDidLayout(markerView: LuggMarkerView)
|
|
19
|
+
fun showCalloutForMarkerView(markerView: LuggMarkerView)
|
|
20
|
+
fun hideCalloutForMarkerView(markerView: LuggMarkerView)
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
class LuggMarkerView(context: Context) : ReactViewGroup(context) {
|
|
@@ -57,6 +59,9 @@ class LuggMarkerView(context: Context) : ReactViewGroup(context) {
|
|
|
57
59
|
var rasterize: Boolean = true
|
|
58
60
|
private set
|
|
59
61
|
|
|
62
|
+
var centerOnPress: Boolean = true
|
|
63
|
+
private set
|
|
64
|
+
|
|
60
65
|
var draggable: Boolean = false
|
|
61
66
|
private set
|
|
62
67
|
|
|
@@ -75,6 +80,12 @@ class LuggMarkerView(context: Context) : ReactViewGroup(context) {
|
|
|
75
80
|
var calloutView: LuggCalloutView? = null
|
|
76
81
|
private set
|
|
77
82
|
|
|
83
|
+
val scaledContentHeight: Float
|
|
84
|
+
get() {
|
|
85
|
+
val (_, height) = measureContentBounds()
|
|
86
|
+
return height * scale
|
|
87
|
+
}
|
|
88
|
+
|
|
78
89
|
private fun measureContentBounds(): Pair<Int, Int> {
|
|
79
90
|
var maxWidth = 0
|
|
80
91
|
var maxHeight = 0
|
|
@@ -266,6 +277,10 @@ class LuggMarkerView(context: Context) : ReactViewGroup(context) {
|
|
|
266
277
|
this.rasterize = rasterize
|
|
267
278
|
}
|
|
268
279
|
|
|
280
|
+
fun setCenterOnPress(centerOnPress: Boolean) {
|
|
281
|
+
this.centerOnPress = centerOnPress
|
|
282
|
+
}
|
|
283
|
+
|
|
269
284
|
fun setDraggable(draggable: Boolean) {
|
|
270
285
|
this.draggable = draggable
|
|
271
286
|
}
|
|
@@ -286,6 +301,14 @@ class LuggMarkerView(context: Context) : ReactViewGroup(context) {
|
|
|
286
301
|
dispatchEvent(MarkerDragEvent(this, MarkerDragEvent.DRAG_END, latitude, longitude, x, y))
|
|
287
302
|
}
|
|
288
303
|
|
|
304
|
+
fun showCallout() {
|
|
305
|
+
delegate?.showCalloutForMarkerView(this)
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
fun hideCallout() {
|
|
309
|
+
delegate?.hideCalloutForMarkerView(this)
|
|
310
|
+
}
|
|
311
|
+
|
|
289
312
|
fun setName(name: String?) {
|
|
290
313
|
this.name = name
|
|
291
314
|
}
|
|
@@ -92,11 +92,24 @@ class LuggMarkerViewManager :
|
|
|
92
92
|
view.setRasterize(value)
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
@ReactProp(name = "centerOnPress", defaultBoolean = true)
|
|
96
|
+
override fun setCenterOnPress(view: LuggMarkerView, value: Boolean) {
|
|
97
|
+
view.setCenterOnPress(value)
|
|
98
|
+
}
|
|
99
|
+
|
|
95
100
|
@ReactProp(name = "draggable", defaultBoolean = false)
|
|
96
101
|
override fun setDraggable(view: LuggMarkerView, value: Boolean) {
|
|
97
102
|
view.setDraggable(value)
|
|
98
103
|
}
|
|
99
104
|
|
|
105
|
+
override fun showCallout(view: LuggMarkerView) {
|
|
106
|
+
view.showCallout()
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
override fun hideCallout(view: LuggMarkerView) {
|
|
110
|
+
view.hideCallout()
|
|
111
|
+
}
|
|
112
|
+
|
|
100
113
|
companion object {
|
|
101
114
|
const val NAME = "LuggMarkerView"
|
|
102
115
|
}
|
|
@@ -12,6 +12,9 @@ class LuggPackage : ReactPackage {
|
|
|
12
12
|
LuggCalloutViewManager(),
|
|
13
13
|
LuggMapWrapperViewManager(),
|
|
14
14
|
LuggPolylineViewManager(),
|
|
15
|
-
LuggPolygonViewManager()
|
|
15
|
+
LuggPolygonViewManager(),
|
|
16
|
+
LuggCircleViewManager(),
|
|
17
|
+
LuggGroundOverlayViewManager(),
|
|
18
|
+
LuggTileOverlayViewManager()
|
|
16
19
|
)
|
|
17
20
|
}
|