@maplibre/maplibre-react-native 11.0.0-alpha.43 → 11.0.0-alpha.44
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/src/main/java/org/maplibre/reactnative/components/AbstractEvent.kt +20 -24
- package/android/src/main/java/org/maplibre/reactnative/components/AbstractEventEmitter.kt +19 -10
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/callout/MLRNCallout.kt +3 -2
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/callout/MLRNCalloutManager.kt +1 -4
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerView.kt +60 -33
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerViewContent.kt +4 -3
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerViewManager.kt +34 -18
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MarkerViewManager.kt +18 -9
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/pointannotation/MLRNPointAnnotation.kt +71 -49
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/pointannotation/MLRNPointAnnotationManager.kt +51 -24
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraStop.kt +36 -15
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateItem.kt +17 -26
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateQueue.kt +1 -3
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.kt +88 -74
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraManager.kt +29 -12
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraModule.kt +9 -7
- package/android/src/main/java/org/maplibre/reactnative/components/camera/constants/CameraEasing.kt +3 -4
- package/android/src/main/java/org/maplibre/reactnative/components/layers/MLRNLayer.kt +44 -27
- package/android/src/main/java/org/maplibre/reactnative/components/layers/MLRNLayerManager.kt +46 -17
- package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.kt +36 -16
- package/android/src/main/java/org/maplibre/reactnative/components/location/MLRNNativeUserLocation.kt +7 -2
- package/android/src/main/java/org/maplibre/reactnative/components/location/MLRNNativeUserLocationManager.kt +8 -8
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapView.kt +4 -2
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapViewManager.kt +3 -3
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +2 -3
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.kt +93 -42
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/CameraChangeTracker.kt +1 -1
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/LayerSourceInfo.kt +4 -2
- package/android/src/main/java/org/maplibre/reactnative/components/sources/MLRNPressableSource.kt +26 -15
- package/android/src/main/java/org/maplibre/reactnative/components/sources/MLRNSource.kt +23 -14
- package/android/src/main/java/org/maplibre/reactnative/components/sources/MLRNSourceManager.kt +27 -13
- package/android/src/main/java/org/maplibre/reactnative/components/sources/imagesource/MLRNImageSource.kt +9 -7
- package/android/src/main/java/org/maplibre/reactnative/components/sources/imagesource/MLRNImageSourceManager.kt +12 -8
- package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/MLRNPressableTileSource.kt +4 -2
- package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/MLRNTileSource.kt +4 -1
- package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/MLRNTileSourceManager.kt +25 -8
- package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/TileSourceInterface.kt +0 -1
- package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/rastersource/MLRNRasterSource.kt +3 -1
- package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/rastersource/MLRNRasterSourceManager.kt +8 -7
- package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/vectorsource/MLRNVectorSource.kt +4 -5
- package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/vectorsource/MLRNVectorSourceManager.kt +4 -7
- package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/vectorsource/MLRNVectorSourceModule.kt +7 -4
- package/android/src/main/java/org/maplibre/reactnative/events/MapChangeEvent.kt +2 -4
- package/android/src/main/java/org/maplibre/reactnative/events/MapPressEvent.kt +10 -9
- package/android/src/main/java/org/maplibre/reactnative/events/MapPressEventWithFeatures.kt +3 -6
- package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationClickEvent.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationDragEvent.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationEvent.kt +9 -7
- package/android/src/main/java/org/maplibre/reactnative/location/LocationManager.kt +18 -16
- package/android/src/main/java/org/maplibre/reactnative/location/TrackUserLocationMode.kt +6 -9
- package/android/src/main/java/org/maplibre/reactnative/location/UserLocation.kt +30 -28
- package/android/src/main/java/org/maplibre/reactnative/location/engine/DefaultLocationEngineProvider.kt +1 -1
- package/android/src/main/java/org/maplibre/reactnative/location/engine/LocationEngineProvidable.kt +1 -1
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNLocationModule.kt +37 -32
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNLogModule.kt +107 -67
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNOfflineModule.kt +311 -234
- package/android/src/main/java/org/maplibre/reactnative/utils/ExpressionParser.kt +1 -4
- package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.kt +62 -31
- package/android/src/main/java/org/maplibre/reactnative/utils/ReactTagResolver.kt +12 -6
- package/android/src/main/location-engine-default/org/maplibre/reactnative/location/engine/LocationEngineProvider.kt +1 -3
- package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/GoogleLocationEngineImpl.kt +31 -20
- package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/GoogleLocationEngineProvider.kt +3 -2
- package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/LocationEngineProvider.kt +1 -3
- package/ios/components/annotations/callout/MLRNCalloutComponentView.mm +3 -9
- package/ios/components/annotations/point-annotation/MLRNPointAnnotation.m +2 -2
- package/ios/components/annotations/point-annotation/MLRNPointAnnotationComponentView.mm +7 -19
- package/ios/components/images/MLRNImages.h +4 -4
- package/ios/components/images/MLRNImagesComponentView.mm +1 -1
- package/ios/components/layers/MLRNLayer.m +1 -1
- package/ios/components/layers/MLRNLayerComponentView.mm +2 -4
- package/ios/components/layers/style/MLRNStyle.h +346 -170
- package/ios/components/layers/style/MLRNStyle.m +668 -711
- package/ios/components/map-view/MLRNMapViewComponentView.mm +1 -1
- package/ios/components/map-view/MLRNMapViewManager.h +7 -7
- package/ios/components/map-view/MLRNMapViewManager.m +4 -4
- package/ios/components/map-view/MLRNMapViewModule.mm +2 -2
- package/ios/components/sources/MLRNSource.h +2 -2
- package/ios/components/sources/geojson-source/MLRNGeoJSONSourceComponentView.h +0 -2
- package/ios/components/sources/geojson-source/MLRNGeoJSONSourceComponentView.mm +1 -1
- package/ios/components/sources/geojson-source/MLRNGeoJSONSourceModule.h +0 -1
- package/ios/components/sources/image-source/MLRNImageSourceComponentView.h +0 -1
- package/ios/components/sources/image-source/MLRNImageSourceComponentView.mm +1 -1
- package/ios/components/sources/tile-sources/raster-source/MLRNRasterSourceComponentView.h +0 -1
- package/ios/components/sources/tile-sources/raster-source/MLRNRasterSourceComponentView.mm +5 -4
- package/ios/components/sources/tile-sources/vector-source/MLRNVectorSourceComponentView.h +0 -1
- package/ios/components/sources/tile-sources/vector-source/MLRNVectorSourceComponentView.mm +6 -5
- package/ios/components/sources/tile-sources/vector-source/MLRNVectorSourceModule.h +0 -1
- package/ios/components/sources/tile-sources/vector-source/MLRNVectorSourceModule.mm +0 -1
- package/ios/modules/logging/MLRNLogModule.mm +1 -1
- package/lib/commonjs/components/annotations/{GeoJSONSourceAnnotation.js → LayerAnnotation.js} +4 -4
- package/lib/commonjs/components/annotations/LayerAnnotation.js.map +1 -0
- package/lib/commonjs/components/annotations/{marker-view/MarkerView.js → marker/Marker.js} +11 -11
- package/lib/commonjs/components/annotations/marker/Marker.js.map +1 -0
- package/lib/commonjs/components/annotations/{point-annotation/PointAnnotation.js → view-annotation/ViewAnnotation.js} +6 -6
- package/lib/commonjs/components/annotations/view-annotation/ViewAnnotation.js.map +1 -0
- package/{src/components/map-view → lib/commonjs/components/map}/AndroidTextureMapViewNativeComponent.ts +1 -1
- package/lib/commonjs/components/{map-view/MapView.js → map/Map.js} +7 -7
- package/lib/commonjs/components/map/Map.js.map +1 -0
- package/lib/commonjs/components/map/NativeMapViewModule.js.map +1 -0
- package/lib/commonjs/components/user-location/UserLocation.js +2 -2
- package/lib/commonjs/components/user-location/UserLocation.js.map +1 -1
- package/lib/commonjs/index.js +20 -20
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/animated/Animated.js +2 -2
- package/lib/commonjs/utils/animated/Animated.js.map +1 -1
- package/lib/module/components/annotations/{GeoJSONSourceAnnotation.js → LayerAnnotation.js} +2 -2
- package/lib/module/components/annotations/LayerAnnotation.js.map +1 -0
- package/lib/module/components/annotations/{marker-view/MarkerView.js → marker/Marker.js} +9 -9
- package/lib/module/components/annotations/marker/Marker.js.map +1 -0
- package/lib/module/components/annotations/{point-annotation/PointAnnotation.js → view-annotation/ViewAnnotation.js} +5 -5
- package/lib/module/components/annotations/view-annotation/ViewAnnotation.js.map +1 -0
- package/lib/{commonjs/components/map-view → module/components/map}/AndroidTextureMapViewNativeComponent.ts +1 -1
- package/lib/module/components/{map-view/MapView.js → map/Map.js} +6 -6
- package/lib/module/components/map/Map.js.map +1 -0
- package/lib/module/components/map/NativeMapViewModule.js.map +1 -0
- package/lib/module/components/user-location/UserLocation.js +2 -2
- package/lib/module/components/user-location/UserLocation.js.map +1 -1
- package/lib/module/index.js +4 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/animated/Animated.js +2 -2
- package/lib/module/utils/animated/Animated.js.map +1 -1
- package/lib/typescript/commonjs/src/components/annotations/{GeoJSONSourceAnnotation.d.ts → LayerAnnotation.d.ts} +3 -4
- package/lib/typescript/commonjs/src/components/annotations/LayerAnnotation.d.ts.map +1 -0
- package/lib/typescript/{module/src/components/annotations/marker-view/MarkerView.d.ts → commonjs/src/components/annotations/marker/Marker.d.ts} +6 -6
- package/lib/typescript/commonjs/src/components/annotations/marker/Marker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/annotations/marker/MarkerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/annotations/view-annotation/PointAnnotationNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/annotations/{point-annotation/PointAnnotation.d.ts → view-annotation/ViewAnnotation.d.ts} +13 -13
- package/lib/typescript/commonjs/src/components/annotations/view-annotation/ViewAnnotation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/map/AndroidTextureMapViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/{map-view/MapView.d.ts → map/Map.d.ts} +18 -18
- package/lib/typescript/commonjs/src/components/map/Map.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/map/MapViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/map/NativeMapViewModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +4 -4
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/sources/PressableSourceProps.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts +1 -1
- package/lib/typescript/module/src/components/annotations/{GeoJSONSourceAnnotation.d.ts → LayerAnnotation.d.ts} +3 -4
- package/lib/typescript/module/src/components/annotations/LayerAnnotation.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src/components/annotations/marker-view/MarkerView.d.ts → module/src/components/annotations/marker/Marker.d.ts} +6 -6
- package/lib/typescript/module/src/components/annotations/marker/Marker.d.ts.map +1 -0
- package/lib/typescript/module/src/components/annotations/marker/MarkerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/components/annotations/view-annotation/PointAnnotationNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/components/annotations/{point-annotation/PointAnnotation.d.ts → view-annotation/ViewAnnotation.d.ts} +13 -13
- package/lib/typescript/module/src/components/annotations/view-annotation/ViewAnnotation.d.ts.map +1 -0
- package/lib/typescript/module/src/components/map/AndroidTextureMapViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/components/{map-view/MapView.d.ts → map/Map.d.ts} +18 -18
- package/lib/typescript/module/src/components/map/Map.d.ts.map +1 -0
- package/lib/typescript/module/src/components/map/MapViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/components/map/NativeMapViewModule.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +4 -4
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/types/sources/PressableSourceProps.d.ts +1 -1
- package/lib/typescript/module/src/utils/animated/Animated.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/annotations/{GeoJSONSourceAnnotation.tsx → LayerAnnotation.tsx} +3 -3
- package/src/components/annotations/{marker-view/MarkerView.tsx → marker/Marker.tsx} +12 -12
- package/src/components/annotations/{point-annotation/PointAnnotation.tsx → view-annotation/ViewAnnotation.tsx} +16 -16
- package/{lib/module/components/map-view → src/components/map}/AndroidTextureMapViewNativeComponent.ts +1 -1
- package/src/components/{map-view/MapView.tsx → map/Map.tsx} +21 -21
- package/src/components/user-location/UserLocation.tsx +3 -3
- package/src/index.ts +18 -13
- package/src/types/sources/PressableSourceProps.ts +1 -1
- package/src/utils/animated/Animated.tsx +2 -2
- package/lib/commonjs/components/annotations/GeoJSONSourceAnnotation.js.map +0 -1
- package/lib/commonjs/components/annotations/marker-view/MarkerView.js.map +0 -1
- package/lib/commonjs/components/annotations/point-annotation/PointAnnotation.js.map +0 -1
- package/lib/commonjs/components/map-view/MapView.js.map +0 -1
- package/lib/commonjs/components/map-view/NativeMapViewModule.js.map +0 -1
- package/lib/module/components/annotations/GeoJSONSourceAnnotation.js.map +0 -1
- package/lib/module/components/annotations/marker-view/MarkerView.js.map +0 -1
- package/lib/module/components/annotations/point-annotation/PointAnnotation.js.map +0 -1
- package/lib/module/components/map-view/MapView.js.map +0 -1
- package/lib/module/components/map-view/NativeMapViewModule.js.map +0 -1
- package/lib/typescript/commonjs/src/components/annotations/GeoJSONSourceAnnotation.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotation.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/map-view/AndroidTextureMapViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/map-view/NativeMapViewModule.d.ts.map +0 -1
- package/lib/typescript/module/src/components/annotations/GeoJSONSourceAnnotation.d.ts.map +0 -1
- package/lib/typescript/module/src/components/annotations/marker-view/MarkerView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotation.d.ts.map +0 -1
- package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts.map +0 -1
- package/lib/typescript/module/src/components/map-view/AndroidTextureMapViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/module/src/components/map-view/MapView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/module/src/components/map-view/NativeMapViewModule.d.ts.map +0 -1
- /package/lib/commonjs/components/annotations/{marker-view → marker}/MarkerViewNativeComponent.ts +0 -0
- /package/lib/commonjs/components/annotations/{point-annotation → view-annotation}/PointAnnotationNativeComponent.ts +0 -0
- /package/lib/commonjs/components/{map-view → map}/MapViewNativeComponent.ts +0 -0
- /package/lib/commonjs/components/{map-view → map}/NativeMapViewModule.js +0 -0
- /package/lib/module/components/annotations/{marker-view → marker}/MarkerViewNativeComponent.ts +0 -0
- /package/lib/module/components/annotations/{point-annotation → view-annotation}/PointAnnotationNativeComponent.ts +0 -0
- /package/lib/module/components/{map-view → map}/MapViewNativeComponent.ts +0 -0
- /package/lib/module/components/{map-view → map}/NativeMapViewModule.js +0 -0
- /package/lib/typescript/commonjs/src/components/annotations/{marker-view → marker}/MarkerViewNativeComponent.d.ts +0 -0
- /package/lib/typescript/commonjs/src/components/annotations/{point-annotation → view-annotation}/PointAnnotationNativeComponent.d.ts +0 -0
- /package/lib/typescript/commonjs/src/components/{map-view → map}/AndroidTextureMapViewNativeComponent.d.ts +0 -0
- /package/lib/typescript/commonjs/src/components/{map-view → map}/MapViewNativeComponent.d.ts +0 -0
- /package/lib/typescript/commonjs/src/components/{map-view → map}/NativeMapViewModule.d.ts +0 -0
- /package/lib/typescript/module/src/components/annotations/{marker-view → marker}/MarkerViewNativeComponent.d.ts +0 -0
- /package/lib/typescript/module/src/components/annotations/{point-annotation → view-annotation}/PointAnnotationNativeComponent.d.ts +0 -0
- /package/lib/typescript/module/src/components/{map-view → map}/AndroidTextureMapViewNativeComponent.d.ts +0 -0
- /package/lib/typescript/module/src/components/{map-view → map}/MapViewNativeComponent.d.ts +0 -0
- /package/lib/typescript/module/src/components/{map-view → map}/NativeMapViewModule.d.ts +0 -0
- /package/src/components/annotations/{marker-view → marker}/MarkerViewNativeComponent.ts +0 -0
- /package/src/components/annotations/{point-annotation → view-annotation}/PointAnnotationNativeComponent.ts +0 -0
- /package/src/components/{map-view → map}/MapViewNativeComponent.ts +0 -0
- /package/src/components/{map-view → map}/NativeMapViewModule.ts +0 -0
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
package org.maplibre.reactnative.components
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.WritableMap
|
|
4
|
-
import com.facebook.react.uimanager.events.Event
|
|
5
|
-
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
6
|
-
|
|
7
|
-
class AbstractEvent(
|
|
8
|
-
viewId: Int,
|
|
9
|
-
private val mEventName: String,
|
|
10
|
-
private val mCanCoalesce: Boolean,
|
|
11
|
-
private val mEvent: WritableMap
|
|
12
|
-
) : Event<AbstractEvent>(viewId) {
|
|
13
|
-
override fun getEventName(): String
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
override fun canCoalesce(): Boolean {
|
|
22
|
-
return mCanCoalesce
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
package org.maplibre.reactnative.components
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap
|
|
4
|
+
import com.facebook.react.uimanager.events.Event
|
|
5
|
+
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
6
|
+
|
|
7
|
+
class AbstractEvent(
|
|
8
|
+
viewId: Int,
|
|
9
|
+
private val mEventName: String,
|
|
10
|
+
private val mCanCoalesce: Boolean,
|
|
11
|
+
private val mEvent: WritableMap?,
|
|
12
|
+
) : Event<AbstractEvent>(viewId) {
|
|
13
|
+
override fun getEventName(): String = mEventName
|
|
14
|
+
|
|
15
|
+
override fun dispatch(rctEventEmitter: RCTEventEmitter) {
|
|
16
|
+
rctEventEmitter.receiveEvent(viewTag, eventName, mEvent)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override fun canCoalesce(): Boolean = mCanCoalesce
|
|
20
|
+
}
|
|
@@ -10,8 +10,9 @@ import com.facebook.react.uimanager.common.UIManagerType
|
|
|
10
10
|
import com.facebook.react.uimanager.events.EventDispatcher
|
|
11
11
|
import org.maplibre.reactnative.events.IEvent
|
|
12
12
|
|
|
13
|
-
abstract class AbstractEventEmitter<T : ViewGroup>(
|
|
14
|
-
|
|
13
|
+
abstract class AbstractEventEmitter<T : ViewGroup>(
|
|
14
|
+
private val reactContext: ReactApplicationContext,
|
|
15
|
+
) : ViewGroupManager<T>() {
|
|
15
16
|
private val mRateLimitedEvents: MutableMap<String?, Long?> = HashMap()
|
|
16
17
|
private var mEventDispatcher: EventDispatcher? = null
|
|
17
18
|
|
|
@@ -26,12 +27,18 @@ abstract class AbstractEventEmitter<T : ViewGroup>(private val reactContext: Rea
|
|
|
26
27
|
mRateLimitedEvents.put(eventCacheKey, System.currentTimeMillis())
|
|
27
28
|
mEventDispatcher!!.dispatchEvent(
|
|
28
29
|
AbstractEvent(
|
|
29
|
-
event.getID(),
|
|
30
|
-
|
|
30
|
+
event.getID(),
|
|
31
|
+
event.getKey(),
|
|
32
|
+
event.canCoalesce(),
|
|
33
|
+
event.toJSON(),
|
|
34
|
+
),
|
|
31
35
|
)
|
|
32
36
|
}
|
|
33
37
|
|
|
34
|
-
override fun addEventEmitters(
|
|
38
|
+
override fun addEventEmitters(
|
|
39
|
+
context: ThemedReactContext,
|
|
40
|
+
view: T,
|
|
41
|
+
) {
|
|
35
42
|
mEventDispatcher =
|
|
36
43
|
UIManagerHelper.getUIManager(context, UIManagerType.Companion.FABRIC)!!.eventDispatcher
|
|
37
44
|
}
|
|
@@ -47,7 +54,8 @@ abstract class AbstractEventEmitter<T : ViewGroup>(private val reactContext: Rea
|
|
|
47
54
|
|
|
48
55
|
for (event in events.entries) {
|
|
49
56
|
exportedEvents.put(
|
|
50
|
-
event.key,
|
|
57
|
+
event.key,
|
|
58
|
+
MapBuilder.of<String?, String?>("registrationName", event.value!!),
|
|
51
59
|
)
|
|
52
60
|
}
|
|
53
61
|
|
|
@@ -56,14 +64,15 @@ abstract class AbstractEventEmitter<T : ViewGroup>(private val reactContext: Rea
|
|
|
56
64
|
|
|
57
65
|
abstract fun customEvents(): Map<String, String>?
|
|
58
66
|
|
|
59
|
-
private fun shouldDropEvent(
|
|
67
|
+
private fun shouldDropEvent(
|
|
68
|
+
cacheKey: String?,
|
|
69
|
+
event: IEvent,
|
|
70
|
+
): Boolean {
|
|
60
71
|
val lastEventTimestamp = mRateLimitedEvents.get(cacheKey)
|
|
61
72
|
return lastEventTimestamp != null && (event.getTimestamp() - lastEventTimestamp) <= BRIDGE_TIMEOUT_MS
|
|
62
73
|
}
|
|
63
74
|
|
|
64
|
-
private fun getEventCacheKey(event: IEvent): String
|
|
65
|
-
return String.format("%s-%s", event.getKey(), event.getType())
|
|
66
|
-
}
|
|
75
|
+
private fun getEventCacheKey(event: IEvent): String = String.format("%s-%s", event.getKey(), event.getType())
|
|
67
76
|
|
|
68
77
|
companion object {
|
|
69
78
|
private const val BRIDGE_TIMEOUT_MS = 10.0
|
package/android/src/main/java/org/maplibre/reactnative/components/annotations/callout/MLRNCallout.kt
CHANGED
|
@@ -3,5 +3,6 @@ package org.maplibre.reactnative.components.annotations.callout
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import com.facebook.react.views.view.ReactViewGroup
|
|
5
5
|
|
|
6
|
-
class MLRNCallout(
|
|
7
|
-
|
|
6
|
+
class MLRNCallout(
|
|
7
|
+
context: Context,
|
|
8
|
+
) : ReactViewGroup(context)
|
|
@@ -11,7 +11,6 @@ import com.facebook.react.viewmanagers.MLRNCalloutManagerInterface
|
|
|
11
11
|
class MLRNCalloutManager :
|
|
12
12
|
ViewGroupManager<MLRNCallout>(),
|
|
13
13
|
MLRNCalloutManagerInterface<MLRNCallout> {
|
|
14
|
-
|
|
15
14
|
private val delegate: MLRNCalloutManagerDelegate<MLRNCallout, MLRNCalloutManager> =
|
|
16
15
|
MLRNCalloutManagerDelegate(this)
|
|
17
16
|
|
|
@@ -23,7 +22,5 @@ class MLRNCalloutManager :
|
|
|
23
22
|
|
|
24
23
|
override fun getName(): String = REACT_CLASS
|
|
25
24
|
|
|
26
|
-
override fun createViewInstance(reactContext: ThemedReactContext): MLRNCallout
|
|
27
|
-
return MLRNCallout(reactContext)
|
|
28
|
-
}
|
|
25
|
+
override fun createViewInstance(reactContext: ThemedReactContext): MLRNCallout = MLRNCallout(reactContext)
|
|
29
26
|
}
|
|
@@ -12,7 +12,10 @@ import org.maplibre.reactnative.components.mapview.MLRNMapView
|
|
|
12
12
|
import org.maplibre.reactnative.utils.GeoJSONUtils
|
|
13
13
|
|
|
14
14
|
@SuppressLint("ViewConstructor")
|
|
15
|
-
class MLRNMarkerView(
|
|
15
|
+
class MLRNMarkerView(
|
|
16
|
+
context: Context,
|
|
17
|
+
) : AbstractMapFeature(context),
|
|
18
|
+
View.OnLayoutChangeListener {
|
|
16
19
|
private var mMapView: MLRNMapView? = null
|
|
17
20
|
private var mChildView: View? = null
|
|
18
21
|
private var mWrapperView: MLRNMarkerViewContent? = null
|
|
@@ -35,19 +38,31 @@ class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLay
|
|
|
35
38
|
private fun disableClippingRecursively(view: View) {
|
|
36
39
|
if (view is ViewGroup) {
|
|
37
40
|
view.disableClipping()
|
|
38
|
-
view.setOnHierarchyChangeListener(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
view.setOnHierarchyChangeListener(
|
|
42
|
+
object : ViewGroup.OnHierarchyChangeListener {
|
|
43
|
+
override fun onChildViewAdded(
|
|
44
|
+
parent: View?,
|
|
45
|
+
child: View?,
|
|
46
|
+
) {
|
|
47
|
+
child?.let { disableClippingRecursively(it) }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
override fun onChildViewRemoved(
|
|
51
|
+
parent: View?,
|
|
52
|
+
child: View?,
|
|
53
|
+
) {}
|
|
54
|
+
},
|
|
55
|
+
)
|
|
44
56
|
for (i in 0 until view.childCount) {
|
|
45
57
|
disableClippingRecursively(view.getChildAt(i))
|
|
46
58
|
}
|
|
47
59
|
}
|
|
48
60
|
}
|
|
49
61
|
|
|
50
|
-
override fun addView(
|
|
62
|
+
override fun addView(
|
|
63
|
+
childView: View,
|
|
64
|
+
childPosition: Int,
|
|
65
|
+
) {
|
|
51
66
|
if (childPosition != 0) return
|
|
52
67
|
|
|
53
68
|
mChildView = childView
|
|
@@ -77,13 +92,9 @@ class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLay
|
|
|
77
92
|
mChildView = null
|
|
78
93
|
}
|
|
79
94
|
|
|
80
|
-
override fun getChildCount(): Int
|
|
81
|
-
return if (mChildView != null) 1 else 0
|
|
82
|
-
}
|
|
95
|
+
override fun getChildCount(): Int = if (mChildView != null) 1 else 0
|
|
83
96
|
|
|
84
|
-
override fun getChildAt(index: Int): View?
|
|
85
|
-
return if (index == 0) mChildView else null
|
|
86
|
-
}
|
|
97
|
+
override fun getChildAt(index: Int): View? = if (index == 0) mChildView else null
|
|
87
98
|
|
|
88
99
|
fun setLngLat(lngLat: DoubleArray?) {
|
|
89
100
|
if (lngLat == null || lngLat.size < 2) return
|
|
@@ -95,14 +106,20 @@ class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLay
|
|
|
95
106
|
}
|
|
96
107
|
}
|
|
97
108
|
|
|
98
|
-
fun setAnchor(
|
|
109
|
+
fun setAnchor(
|
|
110
|
+
x: Float,
|
|
111
|
+
y: Float,
|
|
112
|
+
) {
|
|
99
113
|
mAnchor = floatArrayOf(x, y)
|
|
100
114
|
if (mMarkerInfo != null && mMarkerViewManager != null) {
|
|
101
115
|
mMarkerViewManager!!.updateMarkerAnchor(mMarkerInfo!!, x, y)
|
|
102
116
|
}
|
|
103
117
|
}
|
|
104
118
|
|
|
105
|
-
fun setOffset(
|
|
119
|
+
fun setOffset(
|
|
120
|
+
x: Float,
|
|
121
|
+
y: Float,
|
|
122
|
+
) {
|
|
106
123
|
mOffset = floatArrayOf(x, y)
|
|
107
124
|
val scale = resources.displayMetrics.density
|
|
108
125
|
val pixelOffsetX = x * scale
|
|
@@ -140,13 +157,15 @@ class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLay
|
|
|
140
157
|
mMapView?.offscreenAnnotationViewContainer()?.removeView(mChildView)
|
|
141
158
|
disableClippingRecursively(mChildView!!)
|
|
142
159
|
|
|
143
|
-
mWrapperView =
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
160
|
+
mWrapperView =
|
|
161
|
+
MLRNMarkerViewContent(context).apply {
|
|
162
|
+
layoutParams =
|
|
163
|
+
FrameLayout.LayoutParams(
|
|
164
|
+
FrameLayout.LayoutParams.WRAP_CONTENT,
|
|
165
|
+
FrameLayout.LayoutParams.WRAP_CONTENT,
|
|
166
|
+
)
|
|
167
|
+
addView(mChildView)
|
|
168
|
+
}
|
|
150
169
|
mWrapperView!!.setLayerType(View.LAYER_TYPE_HARDWARE, null)
|
|
151
170
|
|
|
152
171
|
mLastZIndex = ViewGroupManager.getViewZIndex(this@MLRNMarkerView)
|
|
@@ -158,14 +177,15 @@ class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLay
|
|
|
158
177
|
val pixelOffsetX = (mOffset?.get(0) ?: 0f) * scale
|
|
159
178
|
val pixelOffsetY = (mOffset?.get(1) ?: 0f) * scale
|
|
160
179
|
|
|
161
|
-
mMarkerInfo =
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
180
|
+
mMarkerInfo =
|
|
181
|
+
mMarkerViewManager!!.addMarker(
|
|
182
|
+
view = mWrapperView!!,
|
|
183
|
+
latLng = latLng,
|
|
184
|
+
anchorX = mAnchor?.get(0) ?: 0f,
|
|
185
|
+
anchorY = mAnchor?.get(1) ?: 0f,
|
|
186
|
+
offsetX = pixelOffsetX,
|
|
187
|
+
offsetY = pixelOffsetY,
|
|
188
|
+
)
|
|
169
189
|
}
|
|
170
190
|
}
|
|
171
191
|
}
|
|
@@ -186,8 +206,15 @@ class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLay
|
|
|
186
206
|
}
|
|
187
207
|
|
|
188
208
|
override fun onLayoutChange(
|
|
189
|
-
v: View,
|
|
190
|
-
|
|
209
|
+
v: View,
|
|
210
|
+
left: Int,
|
|
211
|
+
top: Int,
|
|
212
|
+
right: Int,
|
|
213
|
+
bottom: Int,
|
|
214
|
+
oldLeft: Int,
|
|
215
|
+
oldTop: Int,
|
|
216
|
+
oldRight: Int,
|
|
217
|
+
oldBottom: Int,
|
|
191
218
|
) {
|
|
192
219
|
if (left == 0 && top == 0 && right == 0 && bottom == 0) return
|
|
193
220
|
|
|
@@ -7,13 +7,14 @@ import com.facebook.react.views.view.ReactViewGroup
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Custom ReactViewGroup that allows content to render outside its bounds (#642).
|
|
10
|
-
* This is used as a wrapper for
|
|
10
|
+
* This is used as a wrapper for Marker content to prevent clipping.
|
|
11
11
|
*
|
|
12
12
|
* Based on rnmapbox/maps implementation:
|
|
13
13
|
* https://github.com/rnmapbox/maps/blob/main/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewContent.kt
|
|
14
14
|
*/
|
|
15
|
-
class MLRNMarkerViewContent(
|
|
16
|
-
|
|
15
|
+
class MLRNMarkerViewContent(
|
|
16
|
+
context: Context,
|
|
17
|
+
) : ReactViewGroup(context) {
|
|
17
18
|
init {
|
|
18
19
|
allowRenderingOutside()
|
|
19
20
|
}
|
|
@@ -15,10 +15,10 @@ import com.facebook.react.viewmanagers.MLRNMarkerViewManagerDelegate
|
|
|
15
15
|
import com.facebook.react.viewmanagers.MLRNMarkerViewManagerInterface
|
|
16
16
|
|
|
17
17
|
@ReactModule(name = MLRNMarkerViewManager.REACT_CLASS)
|
|
18
|
-
class MLRNMarkerViewManager(
|
|
19
|
-
|
|
18
|
+
class MLRNMarkerViewManager(
|
|
19
|
+
private val reactApplicationContext: ReactApplicationContext,
|
|
20
|
+
) : ViewGroupManager<MLRNMarkerView>(),
|
|
20
21
|
MLRNMarkerViewManagerInterface<MLRNMarkerView> {
|
|
21
|
-
|
|
22
22
|
private val delegate: MLRNMarkerViewManagerDelegate<MLRNMarkerView, MLRNMarkerViewManager> =
|
|
23
23
|
MLRNMarkerViewManagerDelegate(this)
|
|
24
24
|
|
|
@@ -30,28 +30,35 @@ class MLRNMarkerViewManager(private val reactApplicationContext: ReactApplicatio
|
|
|
30
30
|
|
|
31
31
|
override fun getName(): String = REACT_CLASS
|
|
32
32
|
|
|
33
|
-
override fun createViewInstance(reactContext: ThemedReactContext): MLRNMarkerView
|
|
34
|
-
return MLRNMarkerView(reactContext)
|
|
35
|
-
}
|
|
33
|
+
override fun createViewInstance(reactContext: ThemedReactContext): MLRNMarkerView = MLRNMarkerView(reactContext)
|
|
36
34
|
|
|
37
|
-
override fun addView(
|
|
35
|
+
override fun addView(
|
|
36
|
+
parent: MLRNMarkerView,
|
|
37
|
+
child: View,
|
|
38
|
+
index: Int,
|
|
39
|
+
) {
|
|
38
40
|
parent.addView(child, index)
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
override fun removeViewAt(
|
|
43
|
+
override fun removeViewAt(
|
|
44
|
+
parent: MLRNMarkerView,
|
|
45
|
+
index: Int,
|
|
46
|
+
) {
|
|
42
47
|
parent.removeViewAt(index)
|
|
43
48
|
}
|
|
44
49
|
|
|
45
|
-
override fun getChildCount(parent: MLRNMarkerView): Int
|
|
46
|
-
return parent.childCount
|
|
47
|
-
}
|
|
50
|
+
override fun getChildCount(parent: MLRNMarkerView): Int = parent.childCount
|
|
48
51
|
|
|
49
|
-
override fun getChildAt(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
override fun getChildAt(
|
|
53
|
+
parent: MLRNMarkerView,
|
|
54
|
+
index: Int,
|
|
55
|
+
): View? = parent.getChildAt(index)
|
|
52
56
|
|
|
53
57
|
@ReactProp(name = "lngLat")
|
|
54
|
-
override fun setLngLat(
|
|
58
|
+
override fun setLngLat(
|
|
59
|
+
markerView: MLRNMarkerView,
|
|
60
|
+
lngLat: Dynamic,
|
|
61
|
+
) {
|
|
55
62
|
if (lngLat.type == ReadableType.Array) {
|
|
56
63
|
val arr = lngLat.asArray()
|
|
57
64
|
if (arr != null && arr.size() >= 2) {
|
|
@@ -61,20 +68,29 @@ class MLRNMarkerViewManager(private val reactApplicationContext: ReactApplicatio
|
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
@ReactProp(name = "anchor")
|
|
64
|
-
override fun setAnchor(
|
|
71
|
+
override fun setAnchor(
|
|
72
|
+
markerView: MLRNMarkerView,
|
|
73
|
+
map: ReadableMap?,
|
|
74
|
+
) {
|
|
65
75
|
if (map != null) {
|
|
66
76
|
markerView.setAnchor(map.getDouble("x").toFloat(), map.getDouble("y").toFloat())
|
|
67
77
|
}
|
|
68
78
|
}
|
|
69
79
|
|
|
70
80
|
@ReactProp(name = "offset")
|
|
71
|
-
override fun setOffset(
|
|
81
|
+
override fun setOffset(
|
|
82
|
+
markerView: MLRNMarkerView,
|
|
83
|
+
map: ReadableMap?,
|
|
84
|
+
) {
|
|
72
85
|
if (map != null) {
|
|
73
86
|
markerView.setOffset(map.getDouble("x").toFloat(), map.getDouble("y").toFloat())
|
|
74
87
|
}
|
|
75
88
|
}
|
|
76
89
|
|
|
77
|
-
override fun setZIndex(
|
|
90
|
+
override fun setZIndex(
|
|
91
|
+
view: MLRNMarkerView,
|
|
92
|
+
zIndex: Float,
|
|
93
|
+
) {
|
|
78
94
|
super.setZIndex(view, zIndex)
|
|
79
95
|
view.updateZIndex(zIndex)
|
|
80
96
|
}
|
|
@@ -10,7 +10,7 @@ import org.maplibre.android.maps.MapView
|
|
|
10
10
|
|
|
11
11
|
class MarkerViewManager(
|
|
12
12
|
private val mapView: MapView,
|
|
13
|
-
private val map: MapLibreMap
|
|
13
|
+
private val map: MapLibreMap,
|
|
14
14
|
) {
|
|
15
15
|
data class MarkerInfo(
|
|
16
16
|
val view: View,
|
|
@@ -18,7 +18,7 @@ class MarkerViewManager(
|
|
|
18
18
|
var anchorX: Float = 0f,
|
|
19
19
|
var anchorY: Float = 0f,
|
|
20
20
|
var offsetX: Float = 0f,
|
|
21
|
-
var offsetY: Float = 0f
|
|
21
|
+
var offsetY: Float = 0f,
|
|
22
22
|
)
|
|
23
23
|
|
|
24
24
|
private val markers = mutableListOf<MarkerInfo>()
|
|
@@ -30,7 +30,7 @@ class MarkerViewManager(
|
|
|
30
30
|
anchorX: Float = 0f,
|
|
31
31
|
anchorY: Float = 0f,
|
|
32
32
|
offsetX: Float = 0f,
|
|
33
|
-
offsetY: Float = 0f
|
|
33
|
+
offsetY: Float = 0f,
|
|
34
34
|
): MarkerInfo {
|
|
35
35
|
val markerInfo = MarkerInfo(view, latLng, anchorX, anchorY, offsetX, offsetY)
|
|
36
36
|
markers.add(markerInfo)
|
|
@@ -81,22 +81,31 @@ class MarkerViewManager(
|
|
|
81
81
|
view.y = screenPos.y - anchorOffsetY + marker.offsetY
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
fun findMarkerByView(view: View): MarkerInfo? {
|
|
85
|
-
return markers.find { it.view == view }
|
|
86
|
-
}
|
|
84
|
+
fun findMarkerByView(view: View): MarkerInfo? = markers.find { it.view == view }
|
|
87
85
|
|
|
88
|
-
fun updateMarkerCoordinate(
|
|
86
|
+
fun updateMarkerCoordinate(
|
|
87
|
+
markerInfo: MarkerInfo,
|
|
88
|
+
latLng: LatLng,
|
|
89
|
+
) {
|
|
89
90
|
markerInfo.latLng = latLng
|
|
90
91
|
updateMarkerPosition(markerInfo)
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
fun updateMarkerAnchor(
|
|
94
|
+
fun updateMarkerAnchor(
|
|
95
|
+
markerInfo: MarkerInfo,
|
|
96
|
+
anchorX: Float,
|
|
97
|
+
anchorY: Float,
|
|
98
|
+
) {
|
|
94
99
|
markerInfo.anchorX = anchorX
|
|
95
100
|
markerInfo.anchorY = anchorY
|
|
96
101
|
updateMarkerPosition(markerInfo)
|
|
97
102
|
}
|
|
98
103
|
|
|
99
|
-
fun updateMarkerOffset(
|
|
104
|
+
fun updateMarkerOffset(
|
|
105
|
+
markerInfo: MarkerInfo,
|
|
106
|
+
offsetX: Float,
|
|
107
|
+
offsetY: Float,
|
|
108
|
+
) {
|
|
100
109
|
markerInfo.offsetX = offsetX
|
|
101
110
|
markerInfo.offsetY = offsetY
|
|
102
111
|
updateMarkerPosition(markerInfo)
|