@maplibre/maplibre-react-native 11.0.0-alpha.19 → 11.0.0-alpha.20
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.
|
@@ -56,13 +56,13 @@ import org.maplibre.reactnative.components.annotations.MLRNPointAnnotation
|
|
|
56
56
|
import org.maplibre.reactnative.components.annotations.MarkerViewManager
|
|
57
57
|
import org.maplibre.reactnative.components.camera.MLRNCamera
|
|
58
58
|
import org.maplibre.reactnative.components.images.MLRNImages
|
|
59
|
+
import org.maplibre.reactnative.components.layers.MLRNLayer
|
|
60
|
+
import org.maplibre.reactnative.components.layers.style.MLRNStyle
|
|
61
|
+
import org.maplibre.reactnative.components.layers.style.MLRNStyleFactory
|
|
59
62
|
import org.maplibre.reactnative.components.location.LocationComponentManager
|
|
60
63
|
import org.maplibre.reactnative.components.location.MLRNNativeUserLocation
|
|
61
64
|
import org.maplibre.reactnative.components.mapview.helpers.CameraChangeTracker
|
|
62
65
|
import org.maplibre.reactnative.components.mapview.helpers.LayerSourceInfo
|
|
63
|
-
import org.maplibre.reactnative.components.layers.MLRNLayer
|
|
64
|
-
import org.maplibre.reactnative.components.layers.style.MLRNStyle
|
|
65
|
-
import org.maplibre.reactnative.components.layers.style.MLRNStyleFactory
|
|
66
66
|
import org.maplibre.reactnative.components.sources.MLRNSource
|
|
67
67
|
import org.maplibre.reactnative.components.sources.MLRNSource.OnPressEvent
|
|
68
68
|
import org.maplibre.reactnative.events.MapChangeEvent
|
|
@@ -196,12 +196,12 @@ open class MLRNMapView(
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
is MLRNSource<*> -> {
|
|
199
|
-
sources
|
|
199
|
+
sources[childView.getID()] = childView
|
|
200
200
|
MapChild.FeatureChild(childView)
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
is MLRNPointAnnotation -> {
|
|
204
|
-
pointAnnotations
|
|
204
|
+
pointAnnotations[childView.getID()] = childView
|
|
205
205
|
MapChild.FeatureChild(childView)
|
|
206
206
|
}
|
|
207
207
|
|
|
@@ -382,7 +382,7 @@ open class MLRNMapView(
|
|
|
382
382
|
if (layer != null) {
|
|
383
383
|
callback.found(layer)
|
|
384
384
|
} else {
|
|
385
|
-
val waiters = layerWaiters.computeIfAbsent(layerID) {
|
|
385
|
+
val waiters = layerWaiters.computeIfAbsent(layerID) { _: String? -> ArrayList() }
|
|
386
386
|
waiters.add(callback)
|
|
387
387
|
}
|
|
388
388
|
}
|
|
@@ -459,12 +459,10 @@ open class MLRNMapView(
|
|
|
459
459
|
fun createSymbolManager(style: Style) {
|
|
460
460
|
symbolManager = SymbolManager(this, this.mapLibreMap!!, style)
|
|
461
461
|
symbolManager!!.setIconAllowOverlap(true)
|
|
462
|
-
symbolManager!!.addClickListener
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
}
|
|
467
|
-
})
|
|
462
|
+
symbolManager!!.addClickListener { symbol ->
|
|
463
|
+
onMarkerClick(symbol)
|
|
464
|
+
true
|
|
465
|
+
}
|
|
468
466
|
symbolManager!!.addDragListener(object : OnSymbolDragListener {
|
|
469
467
|
override fun onAnnotationDragStarted(symbol: Symbol) {
|
|
470
468
|
annotationClicked = true
|
|
@@ -548,10 +546,7 @@ open class MLRNMapView(
|
|
|
548
546
|
val hits: MutableMap<String?, MutableList<Feature?>?> = HashMap()
|
|
549
547
|
val hitTouchableSources: MutableList<MLRNSource<*>> = ArrayList()
|
|
550
548
|
for (touchableSource in touchableSources) {
|
|
551
|
-
val hitbox = touchableSource.getTouchHitbox()
|
|
552
|
-
if (hitbox == null) {
|
|
553
|
-
continue
|
|
554
|
-
}
|
|
549
|
+
val hitbox = touchableSource.getTouchHitbox() ?: continue
|
|
555
550
|
|
|
556
551
|
val halfWidth = hitbox["width"]!!.toFloat() / 2.0f
|
|
557
552
|
val halfHeight = hitbox["height"]!!.toFloat() / 2.0f
|
|
@@ -567,7 +562,7 @@ open class MLRNMapView(
|
|
|
567
562
|
val features =
|
|
568
563
|
mapLibreMap!!.queryRenderedFeatures(hitboxF, *touchableSource.getLayerIDs())
|
|
569
564
|
if (features.isNotEmpty()) {
|
|
570
|
-
hits
|
|
565
|
+
hits[touchableSource.getID()] = features
|
|
571
566
|
hitTouchableSources.add(touchableSource)
|
|
572
567
|
}
|
|
573
568
|
}
|
|
@@ -740,7 +735,7 @@ open class MLRNMapView(
|
|
|
740
735
|
val map = mapLibreMap
|
|
741
736
|
val style = map?.style
|
|
742
737
|
|
|
743
|
-
if (style != null && reactLightProps != null
|
|
738
|
+
if (style != null && reactLightProps != null) {
|
|
744
739
|
val light = style.light
|
|
745
740
|
MLRNStyleFactory.setLightLayerStyle(light, MLRNStyle(context, reactLightProps, map))
|
|
746
741
|
}
|
|
@@ -749,10 +744,10 @@ open class MLRNMapView(
|
|
|
749
744
|
fun setReactContentInset(value: ReadableMap?) {
|
|
750
745
|
if (value != null) {
|
|
751
746
|
val arr = WritableNativeArray()
|
|
752
|
-
arr.pushDouble(if (value.hasKey("top"))
|
|
753
|
-
arr.pushDouble(if (value.hasKey("right"))
|
|
754
|
-
arr.pushDouble(if (value.hasKey("bottom"))
|
|
755
|
-
arr.pushDouble(if (value.hasKey("left"))
|
|
747
|
+
arr.pushDouble(if (value.hasKey("top")) value.getDouble("top") else 0.0)
|
|
748
|
+
arr.pushDouble(if (value.hasKey("right")) value.getDouble("right") else 0.0)
|
|
749
|
+
arr.pushDouble(if (value.hasKey("bottom")) value.getDouble("bottom") else 0.0)
|
|
750
|
+
arr.pushDouble(if (value.hasKey("left")) value.getDouble("left") else 0.0)
|
|
756
751
|
insets = arr
|
|
757
752
|
} else {
|
|
758
753
|
insets = null
|
|
@@ -954,10 +949,8 @@ open class MLRNMapView(
|
|
|
954
949
|
pointInView.y /= density
|
|
955
950
|
val payload: WritableMap = WritableNativeMap()
|
|
956
951
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
array.pushDouble(pointInView.y.toDouble())
|
|
960
|
-
payload.putArray("pointInView", array)
|
|
952
|
+
payload.putDouble("locationX", pointInView.x.toDouble())
|
|
953
|
+
payload.putDouble("locationY", pointInView.y.toDouble())
|
|
961
954
|
|
|
962
955
|
return payload
|
|
963
956
|
}
|
|
@@ -969,11 +962,8 @@ open class MLRNMapView(
|
|
|
969
962
|
|
|
970
963
|
val mapCoordinate = mapLibreMap!!.projection.fromScreenLocation(pointInView)
|
|
971
964
|
val payload: WritableMap = WritableNativeMap()
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
array.pushDouble(mapCoordinate.longitude)
|
|
975
|
-
array.pushDouble(mapCoordinate.latitude)
|
|
976
|
-
payload.putArray("coordinateFromView", array)
|
|
965
|
+
payload.putDouble("longitude", mapCoordinate.longitude)
|
|
966
|
+
payload.putDouble("latitude", mapCoordinate.latitude)
|
|
977
967
|
|
|
978
968
|
return payload
|
|
979
969
|
}
|
|
@@ -1287,7 +1277,7 @@ open class MLRNMapView(
|
|
|
1287
1277
|
val layerIDs = source.getLayerIDs()
|
|
1288
1278
|
|
|
1289
1279
|
for (layerID in layerIDs) {
|
|
1290
|
-
layerToSourceMap
|
|
1280
|
+
layerToSourceMap[layerID] = source
|
|
1291
1281
|
}
|
|
1292
1282
|
}
|
|
1293
1283
|
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
reject:(RCTPromiseRejectBlock)reject {
|
|
84
84
|
CGPoint point = [self project:view coordinate:coordinate];
|
|
85
85
|
|
|
86
|
-
resolve(@
|
|
86
|
+
resolve(@{@"locationX" : @(point.x), @"locationY" : @(point.y)});
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
+ (void)unproject:(MLRNMapView *)view
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
reject:(RCTPromiseRejectBlock)reject {
|
|
93
93
|
CLLocationCoordinate2D coordinate = [view convertPoint:point toCoordinateFromView:view];
|
|
94
94
|
|
|
95
|
-
resolve(@
|
|
95
|
+
resolve(@{@"longitude" : @(coordinate.longitude), @"latitude" : @(coordinate.latitude)});
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
+ (void)takeSnap:(MLRNMapView *)view
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maplibre/maplibre-react-native",
|
|
3
3
|
"description": "React Native library for creating maps with MapLibre Native for Android & iOS",
|
|
4
|
-
"version": "11.0.0-alpha.
|
|
4
|
+
"version": "11.0.0-alpha.20",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": true
|