@rnmapbox/maps 10.0.0-beta.75 → 10.0.0-beta.77
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 -3
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImagesManager.kt +5 -5
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyle.kt +7 -1
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +5 -5
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTLayer.kt +37 -10
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayer.kt +21 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayerManager.kt +65 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayer.kt +40 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayer.kt +43 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayer.kt +40 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayer.kt +40 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayer.kt +40 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayer.kt +18 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayerManager.kt +65 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSkyLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayer.kt +40 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSource.kt +69 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSourceManager.kt +54 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterDemSource.kt +82 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterDemSourceManager.kt +30 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSource.kt +37 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSourceManager.kt +32 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSource.kt +5 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSourceManager.kt +10 -4
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSource.kt +44 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSourceManager.kt +69 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSource.kt +78 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSourceManager.kt +69 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTSource.kt +101 -85
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/events/PointAnnotationDragEvent.java +4 -2
- package/ios/RCTMGL-v10/RCMTGLImage.swift +2 -1
- package/ios/RCTMGL-v10/RCTMGLCamera.swift +11 -31
- package/ios/RCTMGL-v10/RCTMGLImages.swift +57 -17
- package/ios/RCTMGL-v10/RCTMGLInteractiveElement.swift +13 -1
- package/ios/RCTMGL-v10/RCTMGLLayer.swift +35 -6
- package/ios/RCTMGL-v10/RCTMGLLocationModule.swift +27 -4
- package/ios/RCTMGL-v10/RCTMGLMapView.swift +15 -3
- package/ios/RCTMGL-v10/RCTMGLSource.swift +35 -17
- package/ios/RCTMGL-v10/RCTMGLUtils.swift +14 -5
- package/javascript/MGLModule.ts +54 -0
- package/javascript/Mapbox.ts +100 -0
- package/javascript/classes/index.d.ts +20 -1
- package/javascript/components/AbstractLayer.tsx +2 -1
- package/javascript/components/Annotation.tsx +141 -0
- package/javascript/components/BackgroundLayer.tsx +6 -1
- package/javascript/components/{Callout.js → Callout.tsx} +53 -45
- package/javascript/components/CircleLayer.tsx +5 -0
- package/javascript/components/FillExtrusionLayer.tsx +6 -1
- package/javascript/components/FillLayer.tsx +5 -0
- package/javascript/components/HeadingIndicator.tsx +24 -13
- package/javascript/components/HeatmapLayer.tsx +6 -1
- package/javascript/components/ImageSource.tsx +6 -1
- package/javascript/components/Images.tsx +58 -6
- package/javascript/components/LineLayer.tsx +5 -0
- package/javascript/components/MapView.tsx +1 -1
- package/javascript/components/MarkerView.tsx +3 -2
- package/javascript/components/PointAnnotation.tsx +11 -6
- package/javascript/components/RasterDemSource.tsx +5 -0
- package/javascript/components/RasterLayer.tsx +6 -1
- package/javascript/components/RasterSource.tsx +5 -0
- package/javascript/components/ShapeSource.tsx +6 -1
- package/javascript/components/SkyLayer.tsx +5 -0
- package/javascript/components/{Style.js → Style.tsx} +117 -35
- package/javascript/components/SymbolLayer.tsx +6 -1
- package/javascript/components/Terrain.tsx +8 -7
- package/javascript/components/{UserLocation.js → UserLocation.tsx} +106 -95
- package/javascript/components/VectorSource.tsx +6 -1
- package/javascript/index.ts +4 -0
- package/javascript/modules/offline/offlineManager.ts +5 -1
- package/javascript/modules/snapshot/snapshotManager.ts +1 -0
- package/javascript/types/BaseProps.ts +1 -0
- package/javascript/types/Position.ts +1 -0
- package/javascript/utils/Logger.ts +1 -1
- package/javascript/utils/geoUtils.ts +0 -35
- package/javascript/utils/index.ts +0 -8
- package/javascript/utils/styleMap.ts +0 -1598
- package/lib/commonjs/MGLModule.js +37 -0
- package/lib/commonjs/MGLModule.js.map +1 -0
- package/lib/commonjs/Mapbox.js +379 -0
- package/lib/commonjs/Mapbox.js.map +1 -0
- package/lib/commonjs/classes/index.d.js +2 -0
- package/lib/commonjs/classes/index.d.js.map +1 -1
- package/lib/commonjs/components/AbstractLayer.js +1 -2
- package/lib/commonjs/components/AbstractLayer.js.map +1 -1
- package/lib/commonjs/components/{annotations/Annotation.js → Annotation.js} +26 -27
- package/lib/commonjs/components/Annotation.js.map +1 -0
- package/lib/commonjs/components/BackgroundLayer.js.map +1 -1
- package/lib/commonjs/components/Callout.js +7 -33
- package/lib/commonjs/components/Callout.js.map +1 -1
- package/lib/commonjs/components/CircleLayer.js.map +1 -1
- package/lib/commonjs/components/FillExtrusionLayer.js.map +1 -1
- package/lib/commonjs/components/FillLayer.js.map +1 -1
- package/lib/commonjs/components/HeadingIndicator.js +12 -3
- package/lib/commonjs/components/HeadingIndicator.js.map +1 -1
- package/lib/commonjs/components/HeatmapLayer.js.map +1 -1
- package/lib/commonjs/components/ImageSource.js.map +1 -1
- package/lib/commonjs/components/Images.js +17 -1
- package/lib/commonjs/components/Images.js.map +1 -1
- package/lib/commonjs/components/LineLayer.js.map +1 -1
- package/lib/commonjs/components/MapView.js.map +1 -1
- package/lib/commonjs/components/MarkerView.js.map +1 -1
- package/lib/commonjs/components/PointAnnotation.js.map +1 -1
- package/lib/commonjs/components/RasterDemSource.js.map +1 -1
- package/lib/commonjs/components/RasterLayer.js.map +1 -1
- package/lib/commonjs/components/RasterSource.js.map +1 -1
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/commonjs/components/SkyLayer.js.map +1 -1
- package/lib/commonjs/components/Style.js +11 -15
- package/lib/commonjs/components/Style.js.map +1 -1
- package/lib/commonjs/components/SymbolLayer.js.map +1 -1
- package/lib/commonjs/components/Terrain.js.map +1 -1
- package/lib/commonjs/components/UserLocation.js +28 -78
- package/lib/commonjs/components/UserLocation.js.map +1 -1
- package/lib/commonjs/components/VectorSource.js.map +1 -1
- package/lib/commonjs/index.js +16 -339
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/offline/offlineManager.js +6 -0
- package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
- package/lib/commonjs/modules/snapshot/snapshotManager.js.map +1 -1
- package/lib/commonjs/types/Position.js +2 -0
- package/lib/commonjs/types/Position.js.map +1 -0
- package/lib/commonjs/utils/animated/Animated.js.map +1 -1
- package/lib/commonjs/utils/geoUtils.js +1 -19
- package/lib/commonjs/utils/geoUtils.js.map +1 -1
- package/lib/commonjs/utils/index.js +0 -16
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/styleMap.js +1 -1217
- package/lib/commonjs/utils/styleMap.js.map +1 -1
- package/lib/module/MGLModule.js +19 -0
- package/lib/module/MGLModule.js.map +1 -0
- package/lib/module/Mapbox.js +59 -0
- package/lib/module/Mapbox.js.map +1 -0
- package/lib/module/classes/index.d.js +2 -0
- package/lib/module/classes/index.d.js.map +1 -1
- package/lib/module/components/AbstractLayer.js +1 -1
- package/lib/module/components/AbstractLayer.js.map +1 -1
- package/lib/module/components/{annotations/Annotation.js → Annotation.js} +26 -27
- package/lib/module/components/Annotation.js.map +1 -0
- package/lib/module/components/BackgroundLayer.js.map +1 -1
- package/lib/module/components/Callout.js +7 -33
- package/lib/module/components/Callout.js.map +1 -1
- package/lib/module/components/CircleLayer.js.map +1 -1
- package/lib/module/components/FillExtrusionLayer.js.map +1 -1
- package/lib/module/components/FillLayer.js.map +1 -1
- package/lib/module/components/HeadingIndicator.js +12 -3
- package/lib/module/components/HeadingIndicator.js.map +1 -1
- package/lib/module/components/HeatmapLayer.js.map +1 -1
- package/lib/module/components/ImageSource.js.map +1 -1
- package/lib/module/components/Images.js +17 -1
- package/lib/module/components/Images.js.map +1 -1
- package/lib/module/components/LineLayer.js.map +1 -1
- package/lib/module/components/MapView.js.map +1 -1
- package/lib/module/components/MarkerView.js.map +1 -1
- package/lib/module/components/PointAnnotation.js.map +1 -1
- package/lib/module/components/RasterDemSource.js.map +1 -1
- package/lib/module/components/RasterLayer.js.map +1 -1
- package/lib/module/components/RasterSource.js.map +1 -1
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/module/components/SkyLayer.js.map +1 -1
- package/lib/module/components/Style.js +11 -15
- package/lib/module/components/Style.js.map +1 -1
- package/lib/module/components/SymbolLayer.js.map +1 -1
- package/lib/module/components/Terrain.js.map +1 -1
- package/lib/module/components/UserLocation.js +27 -77
- package/lib/module/components/UserLocation.js.map +1 -1
- package/lib/module/components/VectorSource.js.map +1 -1
- package/lib/module/index.js +3 -108
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/offline/offlineManager.js +1 -0
- package/lib/module/modules/offline/offlineManager.js.map +1 -1
- package/lib/module/modules/snapshot/snapshotManager.js.map +1 -1
- package/lib/module/types/Position.js +2 -0
- package/lib/module/types/Position.js.map +1 -0
- package/lib/module/utils/animated/Animated.js.map +1 -1
- package/lib/module/utils/geoUtils.js +0 -16
- package/lib/module/utils/geoUtils.js.map +1 -1
- package/lib/module/utils/index.js +0 -14
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/styleMap.js +0 -1201
- package/lib/module/utils/styleMap.js.map +1 -1
- package/lib/typescript/MGLModule.d.ts +22 -0
- package/lib/typescript/MGLModule.d.ts.map +1 -0
- package/lib/typescript/Mapbox.d.ts +54 -0
- package/lib/typescript/Mapbox.d.ts.map +1 -0
- package/lib/typescript/components/AbstractLayer.d.ts +1 -0
- package/lib/typescript/components/AbstractLayer.d.ts.map +1 -1
- package/lib/typescript/components/Annotation.d.ts +34 -0
- package/lib/typescript/components/Annotation.d.ts.map +1 -0
- package/lib/typescript/components/BackgroundLayer.d.ts +5 -1
- package/lib/typescript/components/BackgroundLayer.d.ts.map +1 -1
- package/lib/typescript/components/Callout.d.ts +41 -0
- package/lib/typescript/components/Callout.d.ts.map +1 -0
- package/lib/typescript/components/CircleLayer.d.ts +4 -0
- package/lib/typescript/components/CircleLayer.d.ts.map +1 -1
- package/lib/typescript/components/FillExtrusionLayer.d.ts +5 -1
- package/lib/typescript/components/FillExtrusionLayer.d.ts.map +1 -1
- package/lib/typescript/components/FillLayer.d.ts +4 -0
- package/lib/typescript/components/FillLayer.d.ts.map +1 -1
- package/lib/typescript/components/HeadingIndicator.d.ts +2 -1
- package/lib/typescript/components/HeadingIndicator.d.ts.map +1 -1
- package/lib/typescript/components/HeatmapLayer.d.ts +5 -1
- package/lib/typescript/components/HeatmapLayer.d.ts.map +1 -1
- package/lib/typescript/components/ImageSource.d.ts +5 -1
- package/lib/typescript/components/ImageSource.d.ts.map +1 -1
- package/lib/typescript/components/Images.d.ts +24 -2
- package/lib/typescript/components/Images.d.ts.map +1 -1
- package/lib/typescript/components/LineLayer.d.ts +4 -0
- package/lib/typescript/components/LineLayer.d.ts.map +1 -1
- package/lib/typescript/components/MapView.d.ts +2 -5
- package/lib/typescript/components/MapView.d.ts.map +1 -1
- package/lib/typescript/components/MarkerView.d.ts +3 -2
- package/lib/typescript/components/MarkerView.d.ts.map +1 -1
- package/lib/typescript/components/PointAnnotation.d.ts +8 -6
- package/lib/typescript/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/components/RasterDemSource.d.ts +4 -0
- package/lib/typescript/components/RasterDemSource.d.ts.map +1 -1
- package/lib/typescript/components/RasterLayer.d.ts +5 -1
- package/lib/typescript/components/RasterLayer.d.ts.map +1 -1
- package/lib/typescript/components/RasterSource.d.ts +4 -0
- package/lib/typescript/components/RasterSource.d.ts.map +1 -1
- package/lib/typescript/components/ShapeSource.d.ts +5 -1
- package/lib/typescript/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/components/SkyLayer.d.ts +4 -0
- package/lib/typescript/components/SkyLayer.d.ts.map +1 -1
- package/lib/typescript/components/Style.d.ts +74 -0
- package/lib/typescript/components/Style.d.ts.map +1 -0
- package/lib/typescript/components/SymbolLayer.d.ts +5 -1
- package/lib/typescript/components/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/components/Terrain.d.ts +2 -2
- package/lib/typescript/components/Terrain.d.ts.map +1 -1
- package/lib/typescript/components/UserLocation.d.ts +102 -0
- package/lib/typescript/components/UserLocation.d.ts.map +1 -0
- package/lib/typescript/components/VectorSource.d.ts +5 -1
- package/lib/typescript/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +4 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/modules/offline/offlineManager.d.ts +2 -1
- package/lib/typescript/modules/offline/offlineManager.d.ts.map +1 -1
- package/lib/typescript/modules/snapshot/snapshotManager.d.ts +1 -0
- package/lib/typescript/modules/snapshot/snapshotManager.d.ts.map +1 -1
- package/lib/typescript/types/BaseProps.d.ts +1 -0
- package/lib/typescript/types/BaseProps.d.ts.map +1 -1
- package/lib/typescript/types/Position.d.ts +2 -0
- package/lib/typescript/types/Position.d.ts.map +1 -0
- package/lib/typescript/utils/Logger.d.ts +1 -1
- package/lib/typescript/utils/Logger.d.ts.map +1 -1
- package/lib/typescript/utils/animated/Animated.d.ts +23 -0
- package/lib/typescript/utils/animated/Animated.d.ts.map +1 -0
- package/lib/typescript/utils/geoUtils.d.ts +0 -8
- package/lib/typescript/utils/geoUtils.d.ts.map +1 -1
- package/lib/typescript/utils/index.d.ts +0 -14
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/lib/typescript/utils/styleMap.d.ts +0 -1406
- package/lib/typescript/utils/styleMap.d.ts.map +1 -1
- package/package.json +35 -39
- package/plugin/build/withMapbox.d.ts +10 -6
- package/plugin/build/withMapbox.js +119 -137
- package/plugin/install.md +21 -0
- package/plugin/src/withMapbox.ts +166 -138
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayer.java +0 -23
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayerManager.java +0 -60
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayer.java +0 -53
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayerManager.java +0 -73
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayer.java +0 -51
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayerManager.java +0 -76
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayer.java +0 -51
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayerManager.java +0 -77
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayer.java +0 -51
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayerManager.java +0 -73
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayer.java +0 -51
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayerManager.java +0 -75
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayer.java +0 -24
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayerManager.java +0 -60
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSkyLayerManager.java +0 -73
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayer.java +0 -51
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayerManager.java +0 -71
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSource.java +0 -76
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSourceManager.java +0 -68
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterDemSource.java +0 -122
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterDemSourceManager.java +0 -64
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSource.java +0 -43
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSourceManager.java +0 -39
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSource.java +0 -103
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSourceManager.java +0 -80
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSource.java +0 -100
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSourceManager.java +0 -80
- package/index.d.ts +0 -516
- package/javascript/components/annotations/Annotation.js +0 -122
- package/javascript/index.js +0 -162
- package/lib/commonjs/components/annotations/Annotation.js.map +0 -1
- package/lib/module/components/annotations/Annotation.js.map +0 -1
- /package/javascript/utils/animated/{Animated.js → Animated.ts} +0 -0
package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTSource.kt
CHANGED
|
@@ -23,6 +23,9 @@ import java.lang.ClassCastException
|
|
|
23
23
|
import java.util.ArrayList
|
|
24
24
|
import java.util.HashMap
|
|
25
25
|
|
|
26
|
+
data class FeatureInfo(val feature: AbstractMapFeature?, var added: Boolean) {
|
|
27
|
+
}
|
|
28
|
+
|
|
26
29
|
abstract class RCTSource<T : Source?>(context: Context?) : AbstractMapFeature(context) {
|
|
27
30
|
@JvmField
|
|
28
31
|
protected var mMap: MapboxMap? = null
|
|
@@ -31,19 +34,40 @@ abstract class RCTSource<T : Source?>(context: Context?) : AbstractMapFeature(co
|
|
|
31
34
|
protected var mSource: T? = null
|
|
32
35
|
protected var mHasPressListener = false
|
|
33
36
|
protected var mTouchHitbox: Map<String, Double>? = null
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
private var mSubFeatures = mutableListOf<FeatureInfo>()
|
|
38
|
+
|
|
36
39
|
val layerIDs: List<String>
|
|
37
40
|
get() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
return mSubFeatures.mapIndexed { index, featureInfo ->
|
|
42
|
+
if (featureInfo.added && featureInfo.feature is AbstractSourceConsumer) {
|
|
43
|
+
featureInfo.feature.iD
|
|
44
|
+
} else {
|
|
45
|
+
null
|
|
46
|
+
}
|
|
47
|
+
}.filterNotNull()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
abstract fun hasNoDataSoRefersToExisting(): Boolean;
|
|
51
|
+
|
|
52
|
+
public var mExisting: Boolean? = null
|
|
53
|
+
|
|
54
|
+
val existing: Boolean
|
|
55
|
+
get() {
|
|
56
|
+
var result: Boolean = false
|
|
57
|
+
mExisting?.also {
|
|
58
|
+
result = it
|
|
59
|
+
} ?: run {
|
|
60
|
+
if (hasNoDataSoRefersToExisting()) {
|
|
61
|
+
Logger.w(
|
|
62
|
+
LOG_TAG,
|
|
63
|
+
"RCTSource: soure with id: $id seems to refer to existing value but existing flag is not set. This is deprecated."
|
|
64
|
+
)
|
|
65
|
+
result = true
|
|
66
|
+
} else {
|
|
67
|
+
result = false
|
|
44
68
|
}
|
|
45
69
|
}
|
|
46
|
-
return
|
|
70
|
+
return result
|
|
47
71
|
}
|
|
48
72
|
|
|
49
73
|
private fun getSourceAs(style: Style, id: String?): T? {
|
|
@@ -55,18 +79,6 @@ abstract class RCTSource<T : Source?>(context: Context?) : AbstractMapFeature(co
|
|
|
55
79
|
}
|
|
56
80
|
}
|
|
57
81
|
|
|
58
|
-
protected fun addLayerToMap(layer: AbstractSourceConsumer?, childPosition: Int) {
|
|
59
|
-
mMapView?.let {
|
|
60
|
-
val mapView = it
|
|
61
|
-
layer?.let {
|
|
62
|
-
it.addToMap(mapView)
|
|
63
|
-
if (!mLayers.contains(it)) {
|
|
64
|
-
mLayers.add(childPosition, it)
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
82
|
open fun hasPressListener(): Boolean {
|
|
71
83
|
return mHasPressListener
|
|
72
84
|
}
|
|
@@ -94,51 +106,56 @@ abstract class RCTSource<T : Source?>(context: Context?) : AbstractMapFeature(co
|
|
|
94
106
|
.build()
|
|
95
107
|
} else mTouchHitbox
|
|
96
108
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
109
|
+
|
|
110
|
+
fun addToMap(existings: Boolean, style: Style, mapView: RCTMGLMapView) {
|
|
111
|
+
mSource = null
|
|
112
|
+
if (existings) {
|
|
113
|
+
val existingSource = getSourceAs(style, iD)
|
|
114
|
+
if (existingSource != null) {
|
|
115
|
+
mSource = existingSource
|
|
116
|
+
} else {
|
|
117
|
+
Logger.w(LOG_TAG, "Source $iD was makred as existing but was not found in style")
|
|
102
118
|
}
|
|
103
|
-
totalCount += mLayers.size
|
|
104
|
-
return totalCount
|
|
105
119
|
}
|
|
120
|
+
if (mSource == null) {
|
|
121
|
+
mSource = makeSource()
|
|
122
|
+
style.addSource(mSource as StyleContract.StyleSourceExtension)
|
|
123
|
+
}
|
|
124
|
+
mSubFeatures?.forEach {
|
|
125
|
+
it.feature?.let {
|
|
126
|
+
it.addToMap(mapView)
|
|
127
|
+
}
|
|
128
|
+
it.added = true
|
|
129
|
+
}
|
|
130
|
+
}
|
|
106
131
|
|
|
107
132
|
override fun addToMap(mapView: RCTMGLMapView) {
|
|
108
133
|
super.addToMap(mapView)
|
|
109
134
|
mMap = mapView.getMapboxMap()
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
for (i in mQueuedLayers!!.indices) {
|
|
121
|
-
addLayerToMap(mQueuedLayers!![i], i)
|
|
122
|
-
}
|
|
123
|
-
mQueuedLayers = null
|
|
124
|
-
} else if (mLayers.size > 0) { // handles the case of switching style url, but keeping layers on map
|
|
125
|
-
for (i in mLayers.indices) {
|
|
126
|
-
addLayerToMap(mLayers[i], i)
|
|
127
|
-
}
|
|
135
|
+
val map = mMap
|
|
136
|
+
if (map == null) {
|
|
137
|
+
Logger.e("RCTSource", "map is exepted to be valid but was null, $iD")
|
|
138
|
+
return
|
|
139
|
+
}
|
|
140
|
+
val style = map.getStyle()
|
|
141
|
+
if (existing || style == null) {
|
|
142
|
+
map.getStyle(object : Style.OnStyleLoaded {
|
|
143
|
+
override fun onStyleLoaded(style: Style) {
|
|
144
|
+
addToMap(existing, style, mapView)
|
|
128
145
|
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
146
|
+
})
|
|
147
|
+
} else {
|
|
148
|
+
addToMap(existing, style, mapView)
|
|
149
|
+
}
|
|
150
|
+
|
|
131
151
|
}
|
|
132
152
|
|
|
133
153
|
override fun removeFromMap(mapView: RCTMGLMapView) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
layer.removeFromMap(mapView)
|
|
154
|
+
mSubFeatures.forEach { it
|
|
155
|
+
it.feature?.let {
|
|
156
|
+
it.removeFromMap(mapView)
|
|
138
157
|
}
|
|
139
|
-
|
|
140
|
-
if (mQueuedLayers != null) {
|
|
141
|
-
mQueuedLayers!!.clear()
|
|
158
|
+
it.added = false
|
|
142
159
|
}
|
|
143
160
|
if (mMap != null && mSource != null && mMap!!.getStyle() != null) {
|
|
144
161
|
try {
|
|
@@ -151,47 +168,48 @@ abstract class RCTSource<T : Source?>(context: Context?) : AbstractMapFeature(co
|
|
|
151
168
|
}
|
|
152
169
|
|
|
153
170
|
fun addLayer(childView: View?, childPosition: Int) {
|
|
154
|
-
|
|
155
|
-
|
|
171
|
+
var feature: AbstractMapFeature? = null
|
|
172
|
+
if (childView !is AbstractMapFeature) {
|
|
173
|
+
Logger.w(LOG_TAG, "Attempted to insert view: $childView to shape source: $iD, since it's not a MapFeature it will not be added")
|
|
174
|
+
} else {
|
|
175
|
+
feature = childView
|
|
156
176
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
177
|
+
|
|
178
|
+
val mapView = mMapView
|
|
179
|
+
|
|
180
|
+
val added = if (mapView != null && feature != null) {
|
|
181
|
+
feature.addToMap(mapView)
|
|
182
|
+
true
|
|
160
183
|
} else {
|
|
161
|
-
|
|
184
|
+
false
|
|
162
185
|
}
|
|
186
|
+
mSubFeatures.add(childPosition, FeatureInfo(feature, added))
|
|
163
187
|
}
|
|
164
188
|
|
|
165
189
|
fun removeLayer(childPosition: Int) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
190
|
+
var featureInfo = mSubFeatures[childPosition]
|
|
191
|
+
if (featureInfo.added) {
|
|
192
|
+
val mapView = mMapView
|
|
193
|
+
if (mapView != null) {
|
|
194
|
+
featureInfo.feature?.let { it.removeFromMap(mapView) }
|
|
195
|
+
}
|
|
196
|
+
featureInfo.added = false
|
|
171
197
|
}
|
|
172
|
-
|
|
198
|
+
mSubFeatures.removeAt(childPosition)
|
|
173
199
|
}
|
|
174
200
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
201
|
+
val childViews: List<AbstractMapFeature>
|
|
202
|
+
get() = mSubFeatures.map { it.feature }.filterNotNull()
|
|
203
|
+
|
|
204
|
+
override fun getChildAt(childPosition: Int): View {
|
|
205
|
+
return childViews[childPosition]
|
|
179
206
|
}
|
|
180
207
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
val mapView = it
|
|
184
|
-
layer?.let {
|
|
185
|
-
it.removeFromMap(mapView)
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
if (mQueuedLayers != null && mQueuedLayers!!.size > 0) {
|
|
189
|
-
mQueuedLayers?.removeAt(childPosition)
|
|
190
|
-
} else {
|
|
191
|
-
mLayers.removeAt(childPosition)
|
|
192
|
-
}
|
|
208
|
+
override fun getChildCount(): Int {
|
|
209
|
+
return childViews.size;
|
|
193
210
|
}
|
|
194
211
|
|
|
212
|
+
|
|
195
213
|
abstract fun makeSource(): T
|
|
196
214
|
class OnPressEvent(var features: List<Feature>, var latLng: LatLng, var screenPoint: PointF)
|
|
197
215
|
|
|
@@ -209,7 +227,5 @@ abstract class RCTSource<T : Source?>(context: Context?) : AbstractMapFeature(co
|
|
|
209
227
|
}
|
|
210
228
|
|
|
211
229
|
init {
|
|
212
|
-
mLayers = ArrayList()
|
|
213
|
-
mQueuedLayers = ArrayList()
|
|
214
230
|
}
|
|
215
231
|
}
|
package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/events/PointAnnotationDragEvent.java
CHANGED
|
@@ -43,9 +43,11 @@ public class PointAnnotationDragEvent extends MapClickEvent {
|
|
|
43
43
|
@Override
|
|
44
44
|
public WritableMap getPayload() {
|
|
45
45
|
WritableMap properties = new WritableNativeMap();
|
|
46
|
-
properties.putString("id", mView.getID());
|
|
47
46
|
properties.putDouble("screenPointX", mScreenPoint.x);
|
|
48
47
|
properties.putDouble("screenPointY", mScreenPoint.y);
|
|
49
|
-
|
|
48
|
+
WritableMap feature = GeoJSONUtils.toPointFeature(mTouchedLatLng, properties);
|
|
49
|
+
feature.putString("id", mView.getID());
|
|
50
|
+
|
|
51
|
+
return feature;
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -9,6 +9,7 @@ class RCTMGLImage : UIView {
|
|
|
9
9
|
var sdf: Bool? = nil
|
|
10
10
|
var stretchX: [[NSNumber]] = []
|
|
11
11
|
var stretchY: [[NSNumber]] = []
|
|
12
|
+
var content: [NSNumber]? = nil
|
|
12
13
|
|
|
13
14
|
weak var images: RCTMGLImageSetter? = nil {
|
|
14
15
|
didSet {
|
|
@@ -42,7 +43,7 @@ class RCTMGLImage : UIView {
|
|
|
42
43
|
|
|
43
44
|
func changeImage(_ image: UIImage, name: String) {
|
|
44
45
|
if let images = images {
|
|
45
|
-
let _ = images.addImage(name: name, image: image, sdf: sdf, stretchX:stretchX, stretchY:stretchY, log: "RCTMGLImage.addImage")
|
|
46
|
+
let _ = images.addImage(name: name, image: image, sdf: sdf, stretchX:stretchX, stretchY:stretchY, content:content, log: "RCTMGLImage.addImage")
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -2,7 +2,7 @@ import Foundation
|
|
|
2
2
|
import MapboxMaps
|
|
3
3
|
import Turf
|
|
4
4
|
|
|
5
|
-
protocol RCTMGLMapComponent :
|
|
5
|
+
protocol RCTMGLMapComponent : class {
|
|
6
6
|
func addToMap(_ map: RCTMGLMapView, style: Style)
|
|
7
7
|
func removeFromMap(_ map: RCTMGLMapView)
|
|
8
8
|
|
|
@@ -104,7 +104,7 @@ open class RCTMGLMapComponentBase : UIView, RCTMGLMapComponent {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
class RCTMGLCamera : RCTMGLMapComponentBase
|
|
107
|
+
class RCTMGLCamera : RCTMGLMapComponentBase {
|
|
108
108
|
var cameraAnimator: BasicCameraAnimator?
|
|
109
109
|
let cameraUpdateQueue = CameraUpdateQueue()
|
|
110
110
|
|
|
@@ -219,7 +219,6 @@ class RCTMGLCamera : RCTMGLMapComponentBase, LocationConsumer {
|
|
|
219
219
|
|
|
220
220
|
func _disableUsetTracking(_ map: MapView) {
|
|
221
221
|
map.viewport.idle()
|
|
222
|
-
map.location.removeLocationConsumer(consumer: self)
|
|
223
222
|
}
|
|
224
223
|
|
|
225
224
|
func _toCoordinateBounds(_ bounds: FeatureCollection) throws -> CoordinateBounds {
|
|
@@ -274,10 +273,17 @@ class RCTMGLCamera : RCTMGLMapComponentBase, LocationConsumer {
|
|
|
274
273
|
}
|
|
275
274
|
|
|
276
275
|
if let locationModule = RCTMGLLocationModule.shared {
|
|
277
|
-
|
|
276
|
+
var isSameProvider = false
|
|
277
|
+
if let currentProvider = map.location.locationProvider as? AnyObject, let newProvider = locationModule.locationProvider as? AnyObject {
|
|
278
|
+
if currentProvider === newProvider {
|
|
279
|
+
isSameProvider = true
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if !isSameProvider {
|
|
283
|
+
map.location.overrideLocationProvider(with: locationModule.locationProvider)
|
|
284
|
+
}
|
|
278
285
|
}
|
|
279
286
|
map.location.locationProvider.requestWhenInUseAuthorization()
|
|
280
|
-
map.location.addLocationConsumer(newConsumer: self)
|
|
281
287
|
var trackingModeChanged = false
|
|
282
288
|
var followOptions = FollowPuckViewportStateOptions()
|
|
283
289
|
switch userTrackingMode {
|
|
@@ -506,32 +512,6 @@ class RCTMGLCamera : RCTMGLMapComponentBase, LocationConsumer {
|
|
|
506
512
|
map.viewport.removeStatusObserver(self)
|
|
507
513
|
super.removeFromMap(map)
|
|
508
514
|
}
|
|
509
|
-
|
|
510
|
-
// MARK: - LocationConsumer
|
|
511
|
-
|
|
512
|
-
func locationUpdate(newLocation: Location) {
|
|
513
|
-
// viewport manages following user location
|
|
514
|
-
if false && followUserLocation {
|
|
515
|
-
withMapView { map in
|
|
516
|
-
var animationType = CameraMode.none
|
|
517
|
-
if let m = self.animationMode as? String, let m = CameraMode(rawValue: m) {
|
|
518
|
-
animationType = m
|
|
519
|
-
}
|
|
520
|
-
let _camera = CameraOptions(center: newLocation.coordinate)
|
|
521
|
-
let _duration = self.animationDuration as? Double ?? 0.5
|
|
522
|
-
switch (animationType) {
|
|
523
|
-
case .flight:
|
|
524
|
-
map.camera.fly(to: _camera, duration: _duration)
|
|
525
|
-
case .ease:
|
|
526
|
-
map.camera.ease(to: _camera, duration: _duration, curve: .easeInOut, completion: nil)
|
|
527
|
-
case .linear:
|
|
528
|
-
map.camera.ease(to: _camera, duration: _duration, curve: .linear, completion: nil)
|
|
529
|
-
default:
|
|
530
|
-
map.mapboxMap.setCamera(to: CameraOptions(center: newLocation.coordinate))
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
515
|
}
|
|
536
516
|
|
|
537
517
|
// MARK: - ViewportStatusObserver
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import MapboxMaps
|
|
2
2
|
|
|
3
3
|
protocol RCTMGLImageSetter : AnyObject {
|
|
4
|
-
func addImage(name: String, image: UIImage, sdf: Bool?, stretchX: [[NSNumber]], stretchY: [[NSNumber]], log: String) -> Bool
|
|
4
|
+
func addImage(name: String, image: UIImage, sdf: Bool?, stretchX: [[NSNumber]], stretchY: [[NSNumber]], content: [NSNumber]?, log: String) -> Bool
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
class RCTMGLImages : UIView, RCTMGLMapComponent {
|
|
@@ -26,7 +26,7 @@ class RCTMGLImages : UIView, RCTMGLMapComponent {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
typealias NativeImageInfo = (name:String, sdf: Bool, stretchX:[(from:Float, to:Float)], stretchY:[(from:Float, to:Float)]);
|
|
29
|
+
typealias NativeImageInfo = (name:String, sdf: Bool, stretchX:[(from:Float, to:Float)], stretchY:[(from:Float, to:Float)], content: (left:Float,top:Float,right:Float,bottom:Float)? );
|
|
30
30
|
var nativeImageInfos: [NativeImageInfo] = []
|
|
31
31
|
|
|
32
32
|
@objc open override func insertReactSubview(_ subview: UIView!, at atIndex: Int) {
|
|
@@ -80,14 +80,15 @@ class RCTMGLImages : UIView, RCTMGLMapComponent {
|
|
|
80
80
|
|
|
81
81
|
for imageName in remoteImages.keys {
|
|
82
82
|
if style.styleManager.getStyleImage(forImageId: imageName) == nil {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
logged("RCTMGLImages.addImagePlaceholder") {
|
|
84
|
+
try? style.addImage(placeholderImage, id: imageName, stretchX: [], stretchY: [])
|
|
85
|
+
missingImages[imageName] = remoteImages[imageName]
|
|
86
|
+
}
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
if missingImages.count > 0 {
|
|
89
91
|
RCTMGLUtils.fetchImages(bridge, style: style, objects: missingImages, forceUpdate: true, callback: { })
|
|
90
|
-
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
|
|
@@ -118,19 +119,51 @@ class RCTMGLImages : UIView, RCTMGLMapComponent {
|
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
func convert(stretch: [[NSNumber]]) -> [(from: Float, to: Float)] {
|
|
122
|
+
static func convert(stretch: [[NSNumber]], scale: Float = 1.0) -> [(from: Float, to: Float)] {
|
|
122
123
|
return stretch.map{ pair in
|
|
123
|
-
return (from: pair[0].floatValue, to: pair[1].floatValue)
|
|
124
|
+
return (from: pair[0].floatValue * scale, to: pair[1].floatValue * scale)
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
func convert(stretch: [(from: Float, to: Float)]) -> [ImageStretches] {
|
|
128
|
+
static func convert(stretch: [(from: Float, to: Float)]) -> [ImageStretches] {
|
|
128
129
|
return stretch.map { v in ImageStretches(first: v.from, second: v.to) }
|
|
129
130
|
}
|
|
130
131
|
|
|
132
|
+
static func convert(stretch: [[NSNumber]], scale: Float = 1.0) -> [ImageStretches] {
|
|
133
|
+
return convert(stretch: convert(stretch: stretch, scale: scale))
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
static func convert(content: (left:Float, top:Float, right:Float, bottom:Float)?) -> ImageContent? {
|
|
137
|
+
guard let content = content else {
|
|
138
|
+
return nil
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return ImageContent(left:content.left, top:content.top, right:content.right, bottom:content.bottom)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
static func convert(content: [NSNumber]?, scale: Float = 1.0) -> (left:Float,top:Float,right:Float,bottom:Float)? {
|
|
145
|
+
guard let content = content else {
|
|
146
|
+
return nil
|
|
147
|
+
}
|
|
148
|
+
guard content.count == 4 else {
|
|
149
|
+
Logger.log(level: .error, message: "Image content should have 4 elements got \(content)")
|
|
150
|
+
return nil
|
|
151
|
+
}
|
|
152
|
+
return (
|
|
153
|
+
left: content[0].floatValue*scale,
|
|
154
|
+
top: content[1].floatValue*scale,
|
|
155
|
+
right: content[2].floatValue*scale,
|
|
156
|
+
bottom: content[3].floatValue*scale
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
static func convert(content: [NSNumber]?, scale: Float = 1.0) -> ImageContent? {
|
|
161
|
+
return convert(content: convert(content: content, scale: scale))
|
|
162
|
+
}
|
|
163
|
+
|
|
131
164
|
func decodeImage(_ imageNameOrInfo: Any) -> NativeImageInfo? {
|
|
132
165
|
if let imageName = imageNameOrInfo as? String {
|
|
133
|
-
return (name: imageName, sdf: false, stretchX:[],stretchY:[])
|
|
166
|
+
return (name: imageName, sdf: false, stretchX:[],stretchY:[],content:nil)
|
|
134
167
|
} else if let imageInfo = imageNameOrInfo as? [String:Any] {
|
|
135
168
|
guard let name = imageInfo["name"] as? String else {
|
|
136
169
|
Logger.log(level: .warn, message: "NativeImage: \(imageInfo) has no name key")
|
|
@@ -144,14 +177,19 @@ class RCTMGLImages : UIView, RCTMGLMapComponent {
|
|
|
144
177
|
}
|
|
145
178
|
|
|
146
179
|
if let stretchXV = imageInfo["stretchX"] as? [[NSNumber]] {
|
|
147
|
-
stretchX = convert(stretch: stretchXV)
|
|
180
|
+
stretchX = RCTMGLImages.convert(stretch: stretchXV)
|
|
148
181
|
}
|
|
149
182
|
|
|
150
183
|
if let stretchYV = imageInfo["stretchY"] as? [[NSNumber]] {
|
|
151
|
-
stretchY = convert(stretch: stretchYV)
|
|
184
|
+
stretchY = RCTMGLImages.convert(stretch: stretchYV)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
var content : (left:Float, top:Float, right:Float, bottom:Float)? = nil
|
|
188
|
+
if let contentV = imageInfo["content"] as? [NSNumber] {
|
|
189
|
+
content = RCTMGLImages.convert(content: contentV)
|
|
152
190
|
}
|
|
153
191
|
|
|
154
|
-
return (name: name, sdf: sdf, stretchX: stretchX, stretchY: stretchY)
|
|
192
|
+
return (name: name, sdf: sdf, stretchX: stretchX, stretchY: stretchY, content: content)
|
|
155
193
|
} else {
|
|
156
194
|
Logger.log(level: .warn, message: "RCTMGLImage.nativeImage, unexpected image: \(imageNameOrInfo)")
|
|
157
195
|
return nil
|
|
@@ -165,8 +203,9 @@ class RCTMGLImages : UIView, RCTMGLMapComponent {
|
|
|
165
203
|
if let image = UIImage(named: imageName) {
|
|
166
204
|
logged("RCTMGLImage.addNativeImage: \(imageName)") {
|
|
167
205
|
try style.addImage(image, id: imageName, sdf: imageInfo.sdf,
|
|
168
|
-
stretchX: convert(stretch: imageInfo.stretchX),
|
|
169
|
-
stretchY: convert(stretch: imageInfo.stretchY)
|
|
206
|
+
stretchX: RCTMGLImages.convert(stretch: imageInfo.stretchX),
|
|
207
|
+
stretchY: RCTMGLImages.convert(stretch: imageInfo.stretchY),
|
|
208
|
+
content: RCTMGLImages.convert(content: imageInfo.content)
|
|
170
209
|
)
|
|
171
210
|
}
|
|
172
211
|
} else {
|
|
@@ -185,15 +224,16 @@ class RCTMGLImages : UIView, RCTMGLMapComponent {
|
|
|
185
224
|
}
|
|
186
225
|
|
|
187
226
|
extension RCTMGLImages : RCTMGLImageSetter {
|
|
188
|
-
func addImage(name: String, image: UIImage, sdf: Bool?, stretchX: [[NSNumber]], stretchY: [[NSNumber]], log: String) -> Bool
|
|
227
|
+
func addImage(name: String, image: UIImage, sdf: Bool?, stretchX: [[NSNumber]], stretchY: [[NSNumber]], content: [NSNumber]?, log: String) -> Bool
|
|
189
228
|
{
|
|
190
229
|
return logged("\(log).addImage") {
|
|
191
230
|
if let style = style {
|
|
192
231
|
try style.addImage(image,
|
|
193
232
|
id:name,
|
|
194
233
|
sdf: sdf ?? false,
|
|
195
|
-
stretchX: convert(stretch:
|
|
196
|
-
stretchY: convert(stretch:
|
|
234
|
+
stretchX: RCTMGLImages.convert(stretch: stretchX),
|
|
235
|
+
stretchY: RCTMGLImages.convert(stretch: stretchY),
|
|
236
|
+
content: RCTMGLImages.convert(content: content)
|
|
197
237
|
)
|
|
198
238
|
return true
|
|
199
239
|
} else {
|
|
@@ -16,7 +16,19 @@ class RCTMGLInteractiveElement : UIView, RCTMGLMapComponent {
|
|
|
16
16
|
"height": NSNumber(value: hitboxDefault)
|
|
17
17
|
]
|
|
18
18
|
|
|
19
|
-
@objc var id: String! = nil
|
|
19
|
+
@objc var id: String! = nil {
|
|
20
|
+
willSet {
|
|
21
|
+
if id != nil && newValue != id {
|
|
22
|
+
Logger.log(level:.warn, message: "Changing id from: \(optional: id) to \(optional: newValue), changing of id is supported")
|
|
23
|
+
if let map = map { removeFromMap(map) }
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
didSet {
|
|
27
|
+
if oldValue != nil && oldValue != id {
|
|
28
|
+
if let map = map { addToMap(map, style: map.mapboxMap.style) }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
20
32
|
|
|
21
33
|
@objc var onDragStart: RCTBubblingEventBlock? = nil
|
|
22
34
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@_spi(Experimental) import MapboxMaps
|
|
2
2
|
|
|
3
|
-
protocol RCTMGLSourceConsumer {
|
|
3
|
+
protocol RCTMGLSourceConsumer : class {
|
|
4
4
|
func addToMap(_ map: RCTMGLMapView, style: Style)
|
|
5
5
|
func removeFromMap(_ map: RCTMGLMapView, style: Style)
|
|
6
6
|
}
|
|
@@ -9,6 +9,8 @@ protocol RCTMGLSourceConsumer {
|
|
|
9
9
|
class RCTMGLLayer : UIView, RCTMGLMapComponent, RCTMGLSourceConsumer {
|
|
10
10
|
weak var bridge : RCTBridge? = nil
|
|
11
11
|
|
|
12
|
+
var waitingForID: String? = nil
|
|
13
|
+
|
|
12
14
|
@objc var sourceLayerID : String? = nil {
|
|
13
15
|
didSet { self.optionsChanged() }
|
|
14
16
|
}
|
|
@@ -31,7 +33,20 @@ class RCTMGLLayer : UIView, RCTMGLMapComponent, RCTMGLSourceConsumer {
|
|
|
31
33
|
didSet { optionsChanged() }
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
@objc var id: String! = nil
|
|
36
|
+
@objc var id: String! = nil {
|
|
37
|
+
willSet {
|
|
38
|
+
if id != nil && newValue != id {
|
|
39
|
+
Logger.log(level:.warn, message: "Changing id from: \(optional: id) to \(optional: newValue), changing of id is supported")
|
|
40
|
+
if let style = style { self.removeFromMap(style) }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
didSet {
|
|
44
|
+
if oldValue != nil && oldValue != id {
|
|
45
|
+
if let map = map, let style = style { self.addToMap(map, style: style) }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
35
50
|
@objc var sourceID: String? = nil {
|
|
36
51
|
didSet { optionsChanged() }
|
|
37
52
|
}
|
|
@@ -74,6 +89,13 @@ class RCTMGLLayer : UIView, RCTMGLMapComponent, RCTMGLSourceConsumer {
|
|
|
74
89
|
}
|
|
75
90
|
|
|
76
91
|
@objc weak var map: RCTMGLMapView? = nil
|
|
92
|
+
|
|
93
|
+
deinit {
|
|
94
|
+
if let waitingForID = waitingForID {
|
|
95
|
+
Logger.log(level:.warn, message: "RCTMGLLayer.removeFromMap - unmetPositionDependency: layer: \(optional: id) was waiting for layer: \(optional: waitingForID) but it hasn't added to map")
|
|
96
|
+
self.waitingForID = nil
|
|
97
|
+
}
|
|
98
|
+
}
|
|
77
99
|
|
|
78
100
|
var styleLayer: Layer? = nil
|
|
79
101
|
|
|
@@ -86,9 +108,9 @@ class RCTMGLLayer : UIView, RCTMGLMapComponent, RCTMGLSourceConsumer {
|
|
|
86
108
|
}
|
|
87
109
|
|
|
88
110
|
func removeAndReaddLayer() {
|
|
89
|
-
if let style = style {
|
|
111
|
+
if let map = map, let style = style {
|
|
90
112
|
self.removeFromMap(style)
|
|
91
|
-
self.
|
|
113
|
+
self.addToMap(map, style:style)
|
|
92
114
|
}
|
|
93
115
|
}
|
|
94
116
|
|
|
@@ -248,7 +270,7 @@ class RCTMGLLayer : UIView, RCTMGLMapComponent, RCTMGLSourceConsumer {
|
|
|
248
270
|
}
|
|
249
271
|
|
|
250
272
|
private func optionsChanged() {
|
|
251
|
-
if let style = self.style {
|
|
273
|
+
if let style = self.style, self.styleLayer != nil {
|
|
252
274
|
self.setOptions(&self.styleLayer!)
|
|
253
275
|
self.loggedApply(style: style)
|
|
254
276
|
}
|
|
@@ -259,10 +281,14 @@ class RCTMGLLayer : UIView, RCTMGLMapComponent, RCTMGLSourceConsumer {
|
|
|
259
281
|
}
|
|
260
282
|
|
|
261
283
|
private func removeFromMap(_ style: Style) {
|
|
284
|
+
if let waitingForID = waitingForID {
|
|
285
|
+
Logger.log(level:.warn, message: "RCTMGLLayer.removeFromMap - unmetPositionDependency: layer: \(optional: id) was waiting for layer: \(optional: waitingForID) but it hasn't added to map")
|
|
286
|
+
}
|
|
287
|
+
|
|
262
288
|
do {
|
|
263
289
|
try style.removeLayer(withId: self.id)
|
|
264
290
|
} catch {
|
|
265
|
-
Logger.log(level: .error, message: "removing layer failed for layer \(optional: id): \(error.localizedDescription)")
|
|
291
|
+
Logger.log(level: .error, message: "RCTMGLLayer.removeFromMap: removing layer failed for layer \(optional: id): \(error.localizedDescription)")
|
|
266
292
|
}
|
|
267
293
|
}
|
|
268
294
|
|
|
@@ -279,8 +305,11 @@ class RCTMGLLayer : UIView, RCTMGLMapComponent, RCTMGLSourceConsumer {
|
|
|
279
305
|
idToWaitFor = nil
|
|
280
306
|
}
|
|
281
307
|
|
|
308
|
+
|
|
282
309
|
if let idToWaitFor = idToWaitFor {
|
|
310
|
+
self.waitingForID = idToWaitFor
|
|
283
311
|
map!.waitForLayerWithID(idToWaitFor) { _ in
|
|
312
|
+
self.waitingForID = nil
|
|
284
313
|
self.attemptInsert(style, layerPosition: layerPosition, onInsert: onInsert)
|
|
285
314
|
}
|
|
286
315
|
} else {
|