@rnmapbox/maps 10.1.19 → 10.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +5 -1
- package/android/install.md +2 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/AbstractEventEmitter.kt +1 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotationModule.kt +3 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXCameraModule.kt +3 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXViewportModule.kt +5 -4
- package/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImageModule.kt +3 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImages.kt +12 -15
- package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/NativeMapViewModule.kt +15 -14
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyle.kt +1 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceModule.kt +7 -6
- package/android/src/main/java/com/rnmapbox/rnmbx/shapeAnimators/RNMBXChangeLineOffsetsShapeAnimatorModule.kt +6 -5
- package/android/src/main/java/com/rnmapbox/rnmbx/shapeAnimators/RNMBXMovePointShapeAnimatorModule.kt +3 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/utils/DownloadMapImageTask.kt +67 -80
- package/android/src/main/java/com/rnmapbox/rnmbx/utils/ViewTagResolver.kt +1 -0
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeMapViewModuleSpec.java +13 -13
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXCameraModuleSpec.java +1 -1
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXChangeLineOffsetsShapeAnimatorModuleSpec.java +4 -4
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXImageModuleSpec.java +1 -1
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXMovePointShapeAnimatorModuleSpec.java +2 -2
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXPointAnnotationModuleSpec.java +1 -1
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXShapeSourceModuleSpec.java +3 -3
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXTileStoreModuleSpec.java +1 -1
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXViewportModuleSpec.java +3 -3
- package/ios/RNMBX/RNMBXFabricHelpers.h +2 -2
- package/ios/RNMBX/RNMBXMarkerViewComponentView.mm +1 -0
- package/ios/install.md +1 -1
- package/lib/commonjs/Mapbox.js +1 -1
- package/lib/commonjs/Mapbox.js.map +1 -1
- package/lib/commonjs/components/Atmosphere.js +1 -1
- package/lib/commonjs/components/Atmosphere.js.map +1 -1
- package/lib/commonjs/components/Camera.js +1 -1
- package/lib/commonjs/components/Camera.js.map +1 -1
- package/lib/commonjs/components/CustomLocationProvider.js +1 -1
- package/lib/commonjs/components/CustomLocationProvider.js.map +1 -1
- package/lib/commonjs/components/Image.js +1 -1
- package/lib/commonjs/components/Image.js.map +1 -1
- package/lib/commonjs/components/Light.js +1 -1
- package/lib/commonjs/components/Light.js.map +1 -1
- package/lib/commonjs/components/LocationPuck.js +1 -1
- package/lib/commonjs/components/LocationPuck.js.map +1 -1
- package/lib/commonjs/components/Style.js +1 -1
- package/lib/commonjs/components/Style.js.map +1 -1
- package/lib/commonjs/components/StyleImport.js +1 -1
- package/lib/commonjs/components/StyleImport.js.map +1 -1
- package/lib/commonjs/components/Terrain.js +1 -1
- package/lib/commonjs/components/Terrain.js.map +1 -1
- package/lib/commonjs/components/Viewport.js +1 -1
- package/lib/commonjs/components/Viewport.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +1 -1
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/typescript/src/components/MapView.d.ts +1 -1
- package/lib/typescript/src/components/PointAnnotation.d.ts +1 -1
- package/lib/typescript/src/components/ShapeSource.d.ts +1 -1
- package/package.json +1 -1
- package/plugin/install.md +2 -2
- package/rnmapbox-maps.podspec +2 -2
- /package/ios/RNMBX/ShapeAnimators/{RNMBXChangeLineOffsetsShapeAnimatorModule.m → RNMBXChangeLineOffsetsShapeAnimatorModule.mm} +0 -0
- /package/ios/RNMBX/ShapeAnimators/{RNMBXMovePointShapeAnimatorModule.m → RNMBXMovePointShapeAnimatorModule.mm} +0 -0
package/android/build.gradle
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
def defaultMapboxMapsImpl = "mapbox"
|
|
2
|
-
def defaultMapboxMapsVersion = "10.
|
|
2
|
+
def defaultMapboxMapsVersion = "10.17.0"
|
|
3
3
|
|
|
4
4
|
def safeExtGet(prop, fallback) {
|
|
5
5
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
@@ -142,6 +142,10 @@ dependencies {
|
|
|
142
142
|
// React Native
|
|
143
143
|
implementation "com.facebook.react:react-native:+"
|
|
144
144
|
|
|
145
|
+
// kotlin coroutines
|
|
146
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${safeExtGet('kotlinxCoroutinesCoreVersion', '1.8.0')}"
|
|
147
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${safeExtGet('kotlinxCoroutinesAndroidVersion', '1.8.0')}"
|
|
148
|
+
|
|
145
149
|
// Mapbox SDK
|
|
146
150
|
customizableDependencies('RNMapboxMapsLibs') {
|
|
147
151
|
if (safeExtGet("RNMapboxMapsImpl", defaultMapboxMapsImpl) == "mapbox") {
|
package/android/install.md
CHANGED
|
@@ -46,7 +46,7 @@ Set `RNMapboxMapsVersion` in `android/build.gradle > buildscript > ext` section
|
|
|
46
46
|
```groovy
|
|
47
47
|
buildscript {
|
|
48
48
|
ext {
|
|
49
|
-
RNMapboxMapsVersion = '11.
|
|
49
|
+
RNMapboxMapsVersion = '11.3.0'
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
```
|
|
@@ -70,7 +70,7 @@ buildscript {
|
|
|
70
70
|
```groovy
|
|
71
71
|
buildscript {
|
|
72
72
|
ext {
|
|
73
|
-
RNMapboxMapsVersion = '11.
|
|
73
|
+
RNMapboxMapsVersion = '11.3.0'
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
```
|
|
@@ -56,7 +56,7 @@ abstract class AbstractEventEmitter<T : ViewGroup?>(reactApplicationContext: Rea
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
override fun addEventEmitters(context: ThemedReactContext, view: T) {
|
|
59
|
+
override fun addEventEmitters(context: ThemedReactContext, view: T & Any) {
|
|
60
60
|
mEventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, view!!.id)
|
|
61
61
|
}
|
|
62
62
|
|
package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotationModule.kt
CHANGED
|
@@ -5,6 +5,7 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
5
5
|
import com.facebook.react.bridge.ReactMethod
|
|
6
6
|
import com.facebook.react.module.annotations.ReactModule
|
|
7
7
|
import com.rnmapbox.rnmbx.NativeRNMBXPointAnnotationModuleSpec
|
|
8
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
8
9
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
9
10
|
|
|
10
11
|
@ReactModule(name = RNMBXPointAnnotationModule.NAME)
|
|
@@ -15,7 +16,7 @@ class RNMBXPointAnnotationModule(reactContext: ReactApplicationContext?, private
|
|
|
15
16
|
const val NAME = "RNMBXPointAnnotationModule"
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
private fun withPointAnnotationOnUIThread(viewRef:
|
|
19
|
+
private fun withPointAnnotationOnUIThread(viewRef: ViewRefTag?, reject: Promise, fn: (RNMBXPointAnnotation) -> Unit) {
|
|
19
20
|
if (viewRef == null) {
|
|
20
21
|
reject.reject(Exception("viewRef is null for RNMBXPointAnnotation"))
|
|
21
22
|
} else {
|
|
@@ -24,7 +25,7 @@ class RNMBXPointAnnotationModule(reactContext: ReactApplicationContext?, private
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
@ReactMethod
|
|
27
|
-
override fun refresh(viewRef:
|
|
28
|
+
override fun refresh(viewRef: ViewRefTag?, promise: Promise) {
|
|
28
29
|
withPointAnnotationOnUIThread(viewRef, promise) {
|
|
29
30
|
it.refresh()
|
|
30
31
|
promise.resolve(null)
|
|
@@ -9,12 +9,13 @@ import com.facebook.react.bridge.WritableMap
|
|
|
9
9
|
import com.facebook.react.bridge.WritableNativeMap
|
|
10
10
|
import com.rnmapbox.rnmbx.NativeRNMBXCameraModuleSpec
|
|
11
11
|
import com.rnmapbox.rnmbx.components.mapview.CommandResponse
|
|
12
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
12
13
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class RNMBXCameraModule(context: ReactApplicationContext, val viewTagResolver: ViewTagResolver) : NativeRNMBXCameraModuleSpec(context) {
|
|
16
17
|
private fun withViewportOnUIThread(
|
|
17
|
-
viewRef:
|
|
18
|
+
viewRef: ViewRefTag?,
|
|
18
19
|
reject: Promise,
|
|
19
20
|
fn: (RNMBXCamera) -> Unit
|
|
20
21
|
) {
|
|
@@ -42,7 +43,7 @@ class RNMBXCameraModule(context: ReactApplicationContext, val viewTagResolver: V
|
|
|
42
43
|
const val NAME = "RNMBXCameraModule"
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
override fun updateCameraStop(viewRef:
|
|
46
|
+
override fun updateCameraStop(viewRef: ViewRefTag?, stop: ReadableMap, promise: Promise) {
|
|
46
47
|
withViewportOnUIThread(viewRef, promise) {
|
|
47
48
|
it.updateCameraStop(stop)
|
|
48
49
|
promise.resolve(null)
|
|
@@ -8,11 +8,12 @@ import com.facebook.react.bridge.WritableMap
|
|
|
8
8
|
import com.facebook.react.bridge.WritableNativeMap
|
|
9
9
|
import com.rnmapbox.rnmbx.NativeRNMBXViewportModuleSpec
|
|
10
10
|
import com.rnmapbox.rnmbx.components.mapview.CommandResponse
|
|
11
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
11
12
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
12
13
|
|
|
13
14
|
class RNMBXViewportModule(context: ReactApplicationContext, val viewTagResolver: ViewTagResolver) : NativeRNMBXViewportModuleSpec(context) {
|
|
14
15
|
private fun withViewportOnUIThread(
|
|
15
|
-
viewRef:
|
|
16
|
+
viewRef: ViewRefTag?,
|
|
16
17
|
reject: Promise,
|
|
17
18
|
fn: (RNMBXViewport) -> Unit
|
|
18
19
|
) {
|
|
@@ -36,14 +37,14 @@ class RNMBXViewportModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
override fun getState(viewRef:
|
|
40
|
+
override fun getState(viewRef: ViewRefTag?, promise: Promise) {
|
|
40
41
|
withViewportOnUIThread(viewRef, promise) {
|
|
41
42
|
promise.resolve(it.getState())
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
override fun transitionTo(
|
|
46
|
-
viewRef:
|
|
47
|
+
viewRef: ViewRefTag?,
|
|
47
48
|
state: ReadableMap,
|
|
48
49
|
transition: ReadableMap?,
|
|
49
50
|
promise: Promise
|
|
@@ -53,7 +54,7 @@ class RNMBXViewportModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
override fun idle(viewRef:
|
|
57
|
+
override fun idle(viewRef: ViewRefTag?, promise: Promise) {
|
|
57
58
|
withViewportOnUIThread(viewRef, promise) {
|
|
58
59
|
it.idle()
|
|
59
60
|
promise.resolve(true)
|
|
@@ -5,6 +5,7 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
5
5
|
import com.facebook.react.bridge.ReactMethod
|
|
6
6
|
import com.facebook.react.module.annotations.ReactModule
|
|
7
7
|
import com.rnmapbox.rnmbx.NativeRNMBXImageModuleSpec
|
|
8
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
8
9
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
9
10
|
|
|
10
11
|
@ReactModule(name = RNMBXImageModule.NAME)
|
|
@@ -15,7 +16,7 @@ class RNMBXImageModule(reactContext: ReactApplicationContext?, private val viewT
|
|
|
15
16
|
const val NAME = "RNMBXImageModule"
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
private fun withImageOnUIThread(viewRef:
|
|
19
|
+
private fun withImageOnUIThread(viewRef: ViewRefTag?, reject: Promise, fn: (RNMBXImage) -> Unit) {
|
|
19
20
|
if (viewRef == null) {
|
|
20
21
|
reject.reject(Exception("viewRef is null for RNMBXImage"))
|
|
21
22
|
} else {
|
|
@@ -24,7 +25,7 @@ class RNMBXImageModule(reactContext: ReactApplicationContext?, private val viewT
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
@ReactMethod
|
|
27
|
-
override fun refresh(viewRef:
|
|
28
|
+
override fun refresh(viewRef: ViewRefTag?, promise: Promise) {
|
|
28
29
|
withImageOnUIThread(viewRef, promise) {
|
|
29
30
|
it.refresh()
|
|
30
31
|
promise.resolve(null)
|
|
@@ -2,13 +2,10 @@ package com.rnmapbox.rnmbx.components.images
|
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import android.graphics.Bitmap
|
|
5
|
-
import com.rnmapbox.rnmbx.components.images.RNMBXImagesManager
|
|
6
|
-
import com.rnmapbox.rnmbx.components.AbstractMapFeature
|
|
7
|
-
import com.rnmapbox.rnmbx.utils.ImageEntry
|
|
8
5
|
import android.graphics.drawable.BitmapDrawable
|
|
9
6
|
import android.util.DisplayMetrics
|
|
7
|
+
import android.util.Log
|
|
10
8
|
import androidx.core.content.res.ResourcesCompat
|
|
11
|
-
import com.mapbox.bindgen.DataRef
|
|
12
9
|
import com.mapbox.bindgen.Expected
|
|
13
10
|
import com.mapbox.bindgen.None
|
|
14
11
|
import com.mapbox.maps.Image
|
|
@@ -17,21 +14,20 @@ import com.mapbox.maps.ImageStretches
|
|
|
17
14
|
import com.mapbox.maps.MapboxMap
|
|
18
15
|
import com.mapbox.maps.Style
|
|
19
16
|
import com.rnmapbox.rnmbx.R
|
|
17
|
+
import com.rnmapbox.rnmbx.components.AbstractMapFeature
|
|
20
18
|
import com.rnmapbox.rnmbx.components.RemovalReason
|
|
21
19
|
import com.rnmapbox.rnmbx.components.mapview.RNMBXMapView
|
|
22
|
-
import com.rnmapbox.rnmbx.components.images.RNMBXImages
|
|
23
20
|
import com.rnmapbox.rnmbx.events.ImageMissingEvent
|
|
24
21
|
import com.rnmapbox.rnmbx.utils.BitmapUtils
|
|
25
22
|
import com.rnmapbox.rnmbx.utils.DownloadMapImageTask
|
|
23
|
+
import com.rnmapbox.rnmbx.utils.ImageEntry
|
|
24
|
+
import com.rnmapbox.rnmbx.v11compat.image.addStyleImage
|
|
25
|
+
import com.rnmapbox.rnmbx.v11compat.image.emptyImage
|
|
26
|
+
import com.rnmapbox.rnmbx.v11compat.image.toImageData
|
|
27
|
+
import com.rnmapbox.rnmbx.v11compat.image.toMapboxImage
|
|
28
|
+
import java.lang.Float.max
|
|
26
29
|
import java.nio.ByteBuffer
|
|
27
30
|
import java.util.AbstractMap
|
|
28
|
-
import java.util.ArrayList
|
|
29
|
-
import java.util.HashMap
|
|
30
|
-
import java.util.HashSet
|
|
31
|
-
|
|
32
|
-
import com.rnmapbox.rnmbx.v11compat.image.*;
|
|
33
|
-
import java.lang.Float.max
|
|
34
|
-
import java.lang.Math.ceil
|
|
35
31
|
import kotlin.math.ceil
|
|
36
32
|
|
|
37
33
|
fun Style.addBitmapImage(imageId: String, bitmap: Bitmap, sdf: Boolean = false, stretchX: List<ImageStretches> = listOf(), stretchY: List<ImageStretches> = listOf(), content: ImageContent? = null, scale: Double = 1.0) : Expected<String, None> {
|
|
@@ -79,7 +75,7 @@ class RNMBXImages(context: Context, private val mManager: RNMBXImagesManager) :
|
|
|
79
75
|
val newImages: MutableMap<String, ImageEntry> = HashMap()
|
|
80
76
|
for ((key, value) in images) {
|
|
81
77
|
val oldValue = mImages?.put(key, value)
|
|
82
|
-
if (oldValue == null) {
|
|
78
|
+
if (oldValue == null || value.uri != oldValue.uri) {
|
|
83
79
|
newImages[key] = value
|
|
84
80
|
}
|
|
85
81
|
}
|
|
@@ -260,14 +256,15 @@ class RNMBXImages(context: Context, private val mManager: RNMBXImagesManager) :
|
|
|
260
256
|
placeholderImage?.let {
|
|
261
257
|
style.addStyleImage(imageEntry.key, it, info)
|
|
262
258
|
}
|
|
263
|
-
missingImages.add(imageEntry)
|
|
264
259
|
mCurrentImages.add(imageEntry.key)
|
|
265
260
|
}
|
|
261
|
+
// make image download even in case the URL changed
|
|
262
|
+
missingImages.add(imageEntry)
|
|
266
263
|
}
|
|
267
264
|
if (missingImages.size > 0) {
|
|
268
265
|
val task = DownloadMapImageTask(context, map, mMapView!!.imageManager)
|
|
269
266
|
val params = missingImages.toTypedArray()
|
|
270
|
-
task.execute(
|
|
267
|
+
task.execute(params)
|
|
271
268
|
}
|
|
272
269
|
}
|
|
273
270
|
|
|
@@ -8,13 +8,14 @@ import com.facebook.react.bridge.WritableNativeMap
|
|
|
8
8
|
import com.rnmapbox.rnmbx.NativeMapViewModuleSpec
|
|
9
9
|
import com.rnmapbox.rnmbx.utils.ConvertUtils
|
|
10
10
|
import com.rnmapbox.rnmbx.utils.ExpressionParser
|
|
11
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
11
12
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
12
13
|
import com.rnmapbox.rnmbx.utils.extensions.toCoordinate
|
|
13
14
|
import com.rnmapbox.rnmbx.utils.extensions.toScreenCoordinate
|
|
14
15
|
|
|
15
16
|
class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver: ViewTagResolver) : NativeMapViewModuleSpec(context) {
|
|
16
17
|
private fun withMapViewOnUIThread(
|
|
17
|
-
viewRef:
|
|
18
|
+
viewRef: ViewRefTag?,
|
|
18
19
|
reject: Promise,
|
|
19
20
|
fn: (RNMBXMapView) -> Unit
|
|
20
21
|
) {
|
|
@@ -38,14 +39,14 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
override fun takeSnap(viewRef:
|
|
42
|
+
override fun takeSnap(viewRef: ViewRefTag?, writeToDisk: Boolean, promise: Promise) {
|
|
42
43
|
withMapViewOnUIThread(viewRef, promise) {
|
|
43
44
|
it.takeSnap(writeToDisk, createCommandResponse(promise))
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
override fun queryTerrainElevation(
|
|
48
|
-
viewRef:
|
|
49
|
+
viewRef: ViewRefTag?,
|
|
49
50
|
coordinates: ReadableArray,
|
|
50
51
|
promise: Promise
|
|
51
52
|
) {
|
|
@@ -55,7 +56,7 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
override fun setSourceVisibility(
|
|
58
|
-
viewRef:
|
|
59
|
+
viewRef: ViewRefTag?,
|
|
59
60
|
visible: Boolean,
|
|
60
61
|
sourceId: String,
|
|
61
62
|
sourceLayerId: String?,
|
|
@@ -68,14 +69,14 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
override fun getCenter(viewRef:
|
|
72
|
+
override fun getCenter(viewRef: ViewRefTag?, promise: Promise) {
|
|
72
73
|
withMapViewOnUIThread(viewRef, promise) {
|
|
73
74
|
it.getCenter(createCommandResponse(promise))
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
override fun getCoordinateFromView(
|
|
78
|
-
viewRef:
|
|
79
|
+
viewRef: ViewRefTag?,
|
|
79
80
|
atPoint: ReadableArray,
|
|
80
81
|
promise: Promise
|
|
81
82
|
) {
|
|
@@ -84,26 +85,26 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
override fun getPointInView(viewRef:
|
|
88
|
+
override fun getPointInView(viewRef: ViewRefTag?, atCoordinate: ReadableArray, promise: Promise) {
|
|
88
89
|
withMapViewOnUIThread(viewRef, promise) {
|
|
89
90
|
it.getPointInView(atCoordinate.toCoordinate(), createCommandResponse(promise))
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
override fun getZoom(viewRef:
|
|
94
|
+
override fun getZoom(viewRef: ViewRefTag?, promise: Promise) {
|
|
94
95
|
withMapViewOnUIThread(viewRef, promise) {
|
|
95
96
|
it.getZoom(createCommandResponse(promise))
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
override fun getVisibleBounds(viewRef:
|
|
100
|
+
override fun getVisibleBounds(viewRef: ViewRefTag?, promise: Promise) {
|
|
100
101
|
withMapViewOnUIThread(viewRef, promise) {
|
|
101
102
|
it.getVisibleBounds(createCommandResponse(promise))
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
override fun queryRenderedFeaturesAtPoint(
|
|
106
|
-
viewRef:
|
|
107
|
+
viewRef: ViewRefTag?,
|
|
107
108
|
atPoint: ReadableArray,
|
|
108
109
|
withFilter: ReadableArray,
|
|
109
110
|
withLayerIDs: ReadableArray,
|
|
@@ -122,7 +123,7 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
override fun queryRenderedFeaturesInRect(
|
|
125
|
-
viewRef:
|
|
126
|
+
viewRef: ViewRefTag?,
|
|
126
127
|
withBBox: ReadableArray,
|
|
127
128
|
withFilter: ReadableArray,
|
|
128
129
|
withLayerIDs: ReadableArray?,
|
|
@@ -141,7 +142,7 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
override fun setHandledMapChangedEvents(
|
|
144
|
-
viewRef:
|
|
145
|
+
viewRef: ViewRefTag?,
|
|
145
146
|
events: ReadableArray,
|
|
146
147
|
promise: Promise
|
|
147
148
|
) {
|
|
@@ -151,14 +152,14 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
|
|
154
|
-
override fun clearData(viewRef:
|
|
155
|
+
override fun clearData(viewRef: ViewRefTag?, promise: Promise) {
|
|
155
156
|
withMapViewOnUIThread(viewRef, promise) {
|
|
156
157
|
it.clearData(createCommandResponse(promise))
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
override fun querySourceFeatures(
|
|
161
|
-
viewRef:
|
|
162
|
+
viewRef: ViewRefTag?,
|
|
162
163
|
sourceId: String,
|
|
163
164
|
withFilter: ReadableArray,
|
|
164
165
|
withSourceLayerIDs: ReadableArray,
|
package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceModule.kt
CHANGED
|
@@ -9,6 +9,7 @@ import com.facebook.react.uimanager.common.UIManagerType
|
|
|
9
9
|
import com.rnmapbox.rnmbx.BuildConfig
|
|
10
10
|
import com.rnmapbox.rnmbx.NativeRNMBXShapeSourceModuleSpec
|
|
11
11
|
import com.rnmapbox.rnmbx.components.mapview.RNMBXMapView
|
|
12
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
12
13
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
13
14
|
|
|
14
15
|
@ReactModule(name = RNMBXShapeSourceModule.NAME)
|
|
@@ -16,7 +17,7 @@ class RNMBXShapeSourceModule(reactContext: ReactApplicationContext?, private val
|
|
|
16
17
|
NativeRNMBXShapeSourceModuleSpec(reactContext) {
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
private fun withShapeSourceOnUIThread(viewRef:
|
|
20
|
+
private fun withShapeSourceOnUIThread(viewRef: ViewRefTag?, reject: Promise, fn: (RNMBXShapeSource) -> Unit) {
|
|
20
21
|
if (viewRef == null) {
|
|
21
22
|
reject.reject(Exception("viewRef is null for RNMBXShapeSource"))
|
|
22
23
|
} else {
|
|
@@ -30,7 +31,7 @@ class RNMBXShapeSourceModule(reactContext: ReactApplicationContext?, private val
|
|
|
30
31
|
|
|
31
32
|
@ReactMethod
|
|
32
33
|
override fun getClusterExpansionZoom(
|
|
33
|
-
viewRef:
|
|
34
|
+
viewRef: ViewRefTag?,
|
|
34
35
|
featureJSON: String,
|
|
35
36
|
promise: Promise
|
|
36
37
|
) {
|
|
@@ -41,10 +42,10 @@ class RNMBXShapeSourceModule(reactContext: ReactApplicationContext?, private val
|
|
|
41
42
|
|
|
42
43
|
@ReactMethod
|
|
43
44
|
override fun getClusterLeaves(
|
|
44
|
-
viewRef:
|
|
45
|
+
viewRef: ViewRefTag?,
|
|
45
46
|
featureJSON: String,
|
|
46
|
-
number:
|
|
47
|
-
offset:
|
|
47
|
+
number: Int,
|
|
48
|
+
offset: Int,
|
|
48
49
|
promise: Promise
|
|
49
50
|
) {
|
|
50
51
|
withShapeSourceOnUIThread(viewRef, promise) {
|
|
@@ -53,7 +54,7 @@ class RNMBXShapeSourceModule(reactContext: ReactApplicationContext?, private val
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
@ReactMethod
|
|
56
|
-
override fun getClusterChildren(viewRef:
|
|
57
|
+
override fun getClusterChildren(viewRef: ViewRefTag?, featureJSON: String, promise: Promise) {
|
|
57
58
|
withShapeSourceOnUIThread(viewRef, promise) {
|
|
58
59
|
it.getClusterChildren(featureJSON, promise)
|
|
59
60
|
}
|
|
@@ -11,6 +11,7 @@ import com.mapbox.turf.TurfConstants.UNIT_METERS
|
|
|
11
11
|
import com.mapbox.turf.TurfMeasurement
|
|
12
12
|
import com.mapbox.turf.TurfMisc
|
|
13
13
|
import com.rnmapbox.rnmbx.NativeRNMBXChangeLineOffsetsShapeAnimatorModuleSpec
|
|
14
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
14
15
|
|
|
15
16
|
class ChangeLineOffsetsShapeAnimator(tag: Tag, _lineString: LineString, startOffset: Double, endOffset: Double): ShapeAnimatorCommon(tag) {
|
|
16
17
|
private var lineString = _lineString
|
|
@@ -153,7 +154,7 @@ class RNMBXChangeLineOffsetsShapeAnimatorModule(
|
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
override fun create(
|
|
156
|
-
tag:
|
|
157
|
+
tag: ViewRefTag,
|
|
157
158
|
coordinates: ReadableArray,
|
|
158
159
|
startOffset: Double,
|
|
159
160
|
endOffset: Double,
|
|
@@ -172,11 +173,11 @@ class RNMBXChangeLineOffsetsShapeAnimatorModule(
|
|
|
172
173
|
promise?.resolve(tag.toInt())
|
|
173
174
|
}
|
|
174
175
|
|
|
175
|
-
private fun getAnimator(tag:
|
|
176
|
+
private fun getAnimator(tag: ViewRefTag): ChangeLineOffsetsShapeAnimator {
|
|
176
177
|
return shapeAnimatorManager.get(tag.toLong()) as ChangeLineOffsetsShapeAnimator
|
|
177
178
|
}
|
|
178
179
|
|
|
179
|
-
override fun setLineString(tag:
|
|
180
|
+
override fun setLineString(tag: ViewRefTag, coordinates: ReadableArray?, startOffset: Double, endOffset: Double, promise: Promise?) {
|
|
180
181
|
val animator = getAnimator(tag)
|
|
181
182
|
|
|
182
183
|
if (coordinates == null) {
|
|
@@ -191,13 +192,13 @@ class RNMBXChangeLineOffsetsShapeAnimatorModule(
|
|
|
191
192
|
promise?.resolve(true)
|
|
192
193
|
}
|
|
193
194
|
|
|
194
|
-
override fun setStartOffset(tag:
|
|
195
|
+
override fun setStartOffset(tag: ViewRefTag, offset: Double, duration: Double, promise: Promise?) {
|
|
195
196
|
val animator = getAnimator(tag)
|
|
196
197
|
animator.setStartOffset(offset, duration / 1000)
|
|
197
198
|
promise?.resolve(true)
|
|
198
199
|
}
|
|
199
200
|
|
|
200
|
-
override fun setEndOffset(tag:
|
|
201
|
+
override fun setEndOffset(tag: ViewRefTag, offset: Double, duration: Double, promise: Promise?) {
|
|
201
202
|
val animator = getAnimator(tag)
|
|
202
203
|
animator.setEndOffset(offset, duration / 1000)
|
|
203
204
|
promise?.resolve(true)
|
package/android/src/main/java/com/rnmapbox/rnmbx/shapeAnimators/RNMBXMovePointShapeAnimatorModule.kt
CHANGED
|
@@ -11,6 +11,7 @@ import com.mapbox.geojson.Point
|
|
|
11
11
|
import com.mapbox.turf.TurfConstants.UNIT_METERS
|
|
12
12
|
import com.mapbox.turf.TurfMeasurement
|
|
13
13
|
import com.rnmapbox.rnmbx.NativeRNMBXMovePointShapeAnimatorModuleSpec
|
|
14
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
14
15
|
|
|
15
16
|
class MovePointShapeAnimator(tag: Tag, coordinate: Point) : ShapeAnimatorCommon(tag) {
|
|
16
17
|
private var point = AnimatableElement<Point>(
|
|
@@ -77,7 +78,7 @@ class RNMBXMovePointShapeAnimatorModule(
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
@ReactMethod
|
|
80
|
-
override fun create(tag:
|
|
81
|
+
override fun create(tag: ViewRefTag, startCoordinate: ReadableArray, promise: Promise) {
|
|
81
82
|
shapeAnimatorManager.add(
|
|
82
83
|
MovePointShapeAnimator(
|
|
83
84
|
tag.toLong(),
|
|
@@ -92,7 +93,7 @@ class RNMBXMovePointShapeAnimatorModule(
|
|
|
92
93
|
|
|
93
94
|
@ReactMethod
|
|
94
95
|
override fun moveTo(
|
|
95
|
-
tag:
|
|
96
|
+
tag: ViewRefTag,
|
|
96
97
|
coordinate: ReadableArray?,
|
|
97
98
|
duration: Double,
|
|
98
99
|
promise: Promise?
|