@maplibre/maplibre-react-native 11.0.0-alpha.7 → 11.0.0-alpha.9

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.
Files changed (338) hide show
  1. package/MapLibreReactNative.podspec +1 -1
  2. package/android/build.gradle +0 -3
  3. package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +43 -0
  4. package/android/src/main/java/org/maplibre/reactnative/components/AbstractEvent.kt +24 -0
  5. package/android/src/main/java/org/maplibre/reactnative/components/AbstractEventEmitter.kt +71 -0
  6. package/android/src/main/java/org/maplibre/reactnative/components/annotation/MLRNPointAnnotation.java +1 -1
  7. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraStop.kt +203 -0
  8. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateItem.kt +109 -0
  9. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateQueue.kt +60 -0
  10. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.kt +409 -0
  11. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraManager.kt +69 -0
  12. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraModule.kt +34 -0
  13. package/android/src/main/java/org/maplibre/reactnative/components/camera/constants/CameraEasing.kt +24 -0
  14. package/android/src/main/java/org/maplibre/reactnative/components/images/MLRNImages.java +1 -2
  15. package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.java +1 -1
  16. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapView.kt +23 -0
  17. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapViewManager.kt +23 -0
  18. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +1338 -0
  19. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.kt +187 -0
  20. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewModule.kt +159 -0
  21. package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/CameraChangeTracker.kt +26 -0
  22. package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/LayerSourceInfo.kt +74 -0
  23. package/android/src/main/java/org/maplibre/reactnative/components/styles/layers/MLRNLayer.java +1 -5
  24. package/android/src/main/java/org/maplibre/reactnative/components/styles/light/MLRNLight.java +1 -6
  25. package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSource.java +2 -9
  26. package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNSource.java +1 -1
  27. package/android/src/main/java/org/maplibre/reactnative/events/AbstractEvent.java +2 -5
  28. package/android/src/main/java/org/maplibre/reactnative/events/MapChangeEvent.kt +18 -0
  29. package/android/src/main/java/org/maplibre/reactnative/events/MapClickEvent.java +4 -0
  30. package/android/src/main/java/org/maplibre/reactnative/events/MapPressEvent.kt +27 -0
  31. package/android/src/main/java/org/maplibre/reactnative/events/TrackUserLocationChangeEvent.kt +24 -0
  32. package/android/src/main/java/org/maplibre/reactnative/events/constants/EventKeys.java +0 -1
  33. package/android/src/main/java/org/maplibre/reactnative/events/constants/EventTypes.java +0 -19
  34. package/android/src/main/java/org/maplibre/reactnative/location/LocationManager.java +1 -1
  35. package/android/src/main/java/org/maplibre/reactnative/location/TrackUserLocationMode.kt +43 -0
  36. package/android/src/main/java/org/maplibre/reactnative/location/{UserTrackingState.java → TrackUserLocationState.java} +1 -1
  37. package/android/src/main/java/org/maplibre/reactnative/location/UserLocation.java +1 -1
  38. package/android/src/main/java/org/maplibre/reactnative/modules/MLRNModule.java +1 -49
  39. package/android/src/main/java/org/maplibre/reactnative/utils/ConvertUtils.java +2 -9
  40. package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.kt +322 -0
  41. package/android/src/main/java/org/maplibre/reactnative/utils/ReactTagResolver.kt +85 -0
  42. package/ios/MLRNCallout.h +1 -1
  43. package/ios/MLRNEvent.m +3 -1
  44. package/ios/MLRNEventTypes.h +10 -31
  45. package/ios/MLRNEventTypes.m +10 -30
  46. package/ios/MLRNImages.h +1 -1
  47. package/ios/MLRNImages.m +1 -1
  48. package/ios/MLRNLayer.h +1 -1
  49. package/ios/MLRNLayer.m +2 -2
  50. package/ios/MLRNLight.h +2 -1
  51. package/ios/MLRNLocationModule.m +2 -2
  52. package/ios/MLRNMapTouchEvent.h +2 -1
  53. package/ios/MLRNMapTouchEvent.m +12 -10
  54. package/ios/MLRNModule.m +5 -52
  55. package/ios/MLRNNativeUserLocation.m +0 -1
  56. package/ios/MLRNOfflineModule.h +2 -2
  57. package/ios/MLRNOfflineModule.m +9 -9
  58. package/ios/MLRNPointAnnotation.h +1 -1
  59. package/ios/MLRNShapeSource.h +1 -1
  60. package/ios/MLRNSource.h +3 -1
  61. package/ios/MLRNStyle.m +20 -20
  62. package/ios/MLRNUtils.h +17 -2
  63. package/ios/MLRNUtils.m +25 -2
  64. package/ios/components/camera/CameraEasing.h +8 -0
  65. package/ios/{CameraStop.h → components/camera/CameraStop.h} +10 -6
  66. package/ios/components/camera/CameraStop.m +75 -0
  67. package/ios/{CameraUpdateItem.m → components/camera/CameraUpdateItem.m} +45 -46
  68. package/ios/components/camera/MLRNCamera.h +26 -0
  69. package/ios/components/camera/MLRNCamera.m +195 -0
  70. package/ios/components/camera/MLRNCameraComponentView.h +18 -0
  71. package/ios/components/camera/MLRNCameraComponentView.mm +192 -0
  72. package/ios/components/camera/MLRNCameraManager.h +11 -0
  73. package/ios/components/camera/MLRNCameraManager.m +20 -0
  74. package/ios/components/camera/MLRNCameraModule.h +4 -0
  75. package/ios/components/camera/MLRNCameraModule.mm +111 -0
  76. package/ios/{MLRNMapView.h → components/map-view/MLRNMapView.h} +42 -20
  77. package/ios/components/map-view/MLRNMapView.m +809 -0
  78. package/ios/components/map-view/MLRNMapViewComponentView.h +18 -0
  79. package/ios/components/map-view/MLRNMapViewComponentView.mm +400 -0
  80. package/ios/components/map-view/MLRNMapViewManager.h +70 -0
  81. package/ios/components/map-view/MLRNMapViewManager.m +163 -0
  82. package/ios/components/map-view/MLRNMapViewModule.h +4 -0
  83. package/ios/components/map-view/MLRNMapViewModule.mm +249 -0
  84. package/ios/{MLRNSnapshotModule → modules/snapshot}/MLRNSnapshotModule.mm +0 -1
  85. package/lib/commonjs/MLRNModule.js +1 -3
  86. package/lib/commonjs/MLRNModule.js.map +1 -1
  87. package/lib/commonjs/components/Annotation.js +1 -13
  88. package/lib/commonjs/components/Annotation.js.map +1 -1
  89. package/lib/commonjs/components/Images.js.map +1 -1
  90. package/lib/commonjs/components/ShapeSource.js +2 -21
  91. package/lib/commonjs/components/ShapeSource.js.map +1 -1
  92. package/lib/commonjs/components/VectorSource.js +3 -26
  93. package/lib/commonjs/components/VectorSource.js.map +1 -1
  94. package/lib/commonjs/components/camera/Camera.js +97 -0
  95. package/lib/commonjs/components/camera/Camera.js.map +1 -0
  96. package/lib/commonjs/components/camera/CameraNativeComponent.ts +61 -0
  97. package/lib/commonjs/components/camera/NativeCameraModule.js +11 -0
  98. package/lib/commonjs/components/camera/NativeCameraModule.js.map +1 -0
  99. package/lib/commonjs/components/map-view/MapView.js +115 -0
  100. package/lib/commonjs/components/map-view/MapView.js.map +1 -0
  101. package/lib/commonjs/components/map-view/MapViewNativeComponent.ts +96 -0
  102. package/lib/commonjs/components/map-view/NativeMapViewModule.js +9 -0
  103. package/lib/commonjs/components/map-view/NativeMapViewModule.js.map +1 -0
  104. package/lib/commonjs/index.js +246 -4
  105. package/lib/commonjs/index.js.map +1 -1
  106. package/lib/commonjs/modules/snapshot/NativeSnapshotModule.js +2 -2
  107. package/lib/commonjs/modules/snapshot/NativeSnapshotModule.js.map +1 -1
  108. package/lib/commonjs/modules/snapshot/SnapshotManager.js +3 -2
  109. package/lib/commonjs/modules/snapshot/SnapshotManager.js.map +1 -1
  110. package/lib/commonjs/types/Bounds.js +2 -0
  111. package/lib/commonjs/types/{OnPressEvent.js.map → Bounds.js.map} +1 -1
  112. package/lib/commonjs/types/PressEvent.js +2 -0
  113. package/lib/{module/types/OnPressEvent.js.map → commonjs/types/PressEvent.js.map} +1 -1
  114. package/lib/commonjs/types/ViewPadding.js +2 -0
  115. package/lib/commonjs/types/{MapLibreRNEvent.js.map → ViewPadding.js.map} +1 -1
  116. package/lib/commonjs/types/codegen/UnsafeMixed.js +2 -0
  117. package/lib/commonjs/types/codegen/UnsafeMixed.js.map +1 -0
  118. package/lib/commonjs/utils/index.js +0 -11
  119. package/lib/commonjs/utils/index.js.map +1 -1
  120. package/lib/module/MLRNModule.js +0 -1
  121. package/lib/module/MLRNModule.js.map +1 -1
  122. package/lib/module/components/Annotation.js +2 -14
  123. package/lib/module/components/Annotation.js.map +1 -1
  124. package/lib/module/components/Images.js.map +1 -1
  125. package/lib/module/components/ShapeSource.js +3 -22
  126. package/lib/module/components/ShapeSource.js.map +1 -1
  127. package/lib/module/components/VectorSource.js +4 -27
  128. package/lib/module/components/VectorSource.js.map +1 -1
  129. package/lib/module/components/camera/Camera.js +92 -0
  130. package/lib/module/components/camera/Camera.js.map +1 -0
  131. package/lib/module/components/camera/CameraNativeComponent.ts +61 -0
  132. package/lib/module/components/camera/NativeCameraModule.js +10 -0
  133. package/lib/module/components/camera/NativeCameraModule.js.map +1 -0
  134. package/lib/module/components/map-view/MapView.js +110 -0
  135. package/lib/module/components/map-view/MapView.js.map +1 -0
  136. package/lib/module/components/map-view/MapViewNativeComponent.ts +96 -0
  137. package/lib/module/components/map-view/NativeMapViewModule.js +5 -0
  138. package/lib/module/components/map-view/NativeMapViewModule.js.map +1 -0
  139. package/lib/module/index.js +30 -1
  140. package/lib/module/index.js.map +1 -1
  141. package/lib/module/modules/snapshot/NativeSnapshotModule.js +1 -1
  142. package/lib/module/modules/snapshot/NativeSnapshotModule.js.map +1 -1
  143. package/lib/module/modules/snapshot/SnapshotManager.js +1 -1
  144. package/lib/module/modules/snapshot/SnapshotManager.js.map +1 -1
  145. package/lib/module/types/Bounds.js +2 -0
  146. package/lib/module/types/{MapLibreRNEvent.js.map → Bounds.js.map} +1 -1
  147. package/lib/module/types/PressEvent.js +2 -0
  148. package/lib/module/types/PressEvent.js.map +1 -0
  149. package/lib/module/types/ViewPadding.js +2 -0
  150. package/lib/module/types/ViewPadding.js.map +1 -0
  151. package/lib/module/types/codegen/UnsafeMixed.js +2 -0
  152. package/lib/module/types/codegen/UnsafeMixed.js.map +1 -0
  153. package/lib/module/utils/index.js +0 -9
  154. package/lib/module/utils/index.js.map +1 -1
  155. package/lib/typescript/commonjs/src/MLRNModule.d.ts +1 -7
  156. package/lib/typescript/commonjs/src/MLRNModule.d.ts.map +1 -1
  157. package/lib/typescript/commonjs/src/components/Annotation.d.ts +3 -3
  158. package/lib/typescript/commonjs/src/components/Annotation.d.ts.map +1 -1
  159. package/lib/typescript/commonjs/src/components/Images.d.ts +1 -2
  160. package/lib/typescript/commonjs/src/components/Images.d.ts.map +1 -1
  161. package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +2 -5
  162. package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
  163. package/lib/typescript/commonjs/src/components/VectorSource.d.ts +3 -2
  164. package/lib/typescript/commonjs/src/components/VectorSource.d.ts.map +1 -1
  165. package/lib/typescript/commonjs/src/components/camera/Camera.d.ts +180 -0
  166. package/lib/typescript/commonjs/src/components/camera/Camera.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/src/components/camera/CameraNativeComponent.d.ts +37 -0
  168. package/lib/typescript/commonjs/src/components/camera/CameraNativeComponent.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/src/components/camera/NativeCameraModule.d.ts +27 -0
  170. package/lib/typescript/commonjs/src/components/camera/NativeCameraModule.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts +323 -0
  172. package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts +69 -0
  174. package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/src/components/map-view/NativeMapViewModule.d.ts +45 -0
  176. package/lib/typescript/commonjs/src/components/map-view/NativeMapViewModule.d.ts.map +1 -0
  177. package/lib/typescript/commonjs/src/index.d.ts +41 -1
  178. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  179. package/lib/typescript/commonjs/src/modules/snapshot/NativeSnapshotModule.d.ts +2 -1
  180. package/lib/typescript/commonjs/src/modules/snapshot/NativeSnapshotModule.d.ts.map +1 -1
  181. package/lib/typescript/commonjs/src/types/Bounds.d.ts +2 -0
  182. package/lib/typescript/commonjs/src/types/Bounds.d.ts.map +1 -0
  183. package/lib/typescript/commonjs/src/types/PressEvent.d.ts +16 -0
  184. package/lib/typescript/commonjs/src/types/PressEvent.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/src/types/ViewPadding.d.ts +7 -0
  186. package/lib/typescript/commonjs/src/types/ViewPadding.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/src/types/codegen/UnsafeMixed.d.ts +10 -0
  188. package/lib/typescript/commonjs/src/types/codegen/UnsafeMixed.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/src/utils/index.d.ts +1 -3
  190. package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
  191. package/lib/typescript/module/src/MLRNModule.d.ts +1 -7
  192. package/lib/typescript/module/src/MLRNModule.d.ts.map +1 -1
  193. package/lib/typescript/module/src/components/Annotation.d.ts +3 -3
  194. package/lib/typescript/module/src/components/Annotation.d.ts.map +1 -1
  195. package/lib/typescript/module/src/components/Images.d.ts +1 -2
  196. package/lib/typescript/module/src/components/Images.d.ts.map +1 -1
  197. package/lib/typescript/module/src/components/ShapeSource.d.ts +2 -5
  198. package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
  199. package/lib/typescript/module/src/components/VectorSource.d.ts +3 -2
  200. package/lib/typescript/module/src/components/VectorSource.d.ts.map +1 -1
  201. package/lib/typescript/module/src/components/camera/Camera.d.ts +180 -0
  202. package/lib/typescript/module/src/components/camera/Camera.d.ts.map +1 -0
  203. package/lib/typescript/module/src/components/camera/CameraNativeComponent.d.ts +37 -0
  204. package/lib/typescript/module/src/components/camera/CameraNativeComponent.d.ts.map +1 -0
  205. package/lib/typescript/module/src/components/camera/NativeCameraModule.d.ts +27 -0
  206. package/lib/typescript/module/src/components/camera/NativeCameraModule.d.ts.map +1 -0
  207. package/lib/typescript/module/src/components/map-view/MapView.d.ts +323 -0
  208. package/lib/typescript/module/src/components/map-view/MapView.d.ts.map +1 -0
  209. package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts +69 -0
  210. package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts.map +1 -0
  211. package/lib/typescript/module/src/components/map-view/NativeMapViewModule.d.ts +45 -0
  212. package/lib/typescript/module/src/components/map-view/NativeMapViewModule.d.ts.map +1 -0
  213. package/lib/typescript/module/src/index.d.ts +41 -1
  214. package/lib/typescript/module/src/index.d.ts.map +1 -1
  215. package/lib/typescript/module/src/modules/snapshot/NativeSnapshotModule.d.ts +2 -1
  216. package/lib/typescript/module/src/modules/snapshot/NativeSnapshotModule.d.ts.map +1 -1
  217. package/lib/typescript/module/src/types/Bounds.d.ts +2 -0
  218. package/lib/typescript/module/src/types/Bounds.d.ts.map +1 -0
  219. package/lib/typescript/module/src/types/PressEvent.d.ts +16 -0
  220. package/lib/typescript/module/src/types/PressEvent.d.ts.map +1 -0
  221. package/lib/typescript/module/src/types/ViewPadding.d.ts +7 -0
  222. package/lib/typescript/module/src/types/ViewPadding.d.ts.map +1 -0
  223. package/lib/typescript/module/src/types/codegen/UnsafeMixed.d.ts +10 -0
  224. package/lib/typescript/module/src/types/codegen/UnsafeMixed.d.ts.map +1 -0
  225. package/lib/typescript/module/src/utils/index.d.ts +1 -3
  226. package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
  227. package/package.json +38 -28
  228. package/src/MLRNModule.ts +0 -10
  229. package/src/components/Annotation.tsx +8 -23
  230. package/src/components/Images.tsx +2 -4
  231. package/src/components/ShapeSource.tsx +18 -31
  232. package/src/components/VectorSource.tsx +5 -28
  233. package/src/components/camera/Camera.tsx +311 -0
  234. package/src/components/camera/CameraNativeComponent.ts +61 -0
  235. package/src/components/camera/NativeCameraModule.ts +39 -0
  236. package/src/components/map-view/MapView.tsx +582 -0
  237. package/src/components/map-view/MapViewNativeComponent.ts +96 -0
  238. package/src/components/map-view/NativeMapViewModule.ts +83 -0
  239. package/src/index.ts +86 -1
  240. package/src/modules/snapshot/NativeSnapshotModule.ts +1 -2
  241. package/src/modules/snapshot/SnapshotManager.ts +1 -1
  242. package/src/types/Bounds.ts +1 -0
  243. package/src/types/PressEvent.ts +19 -0
  244. package/src/types/ViewPadding.ts +6 -0
  245. package/src/types/codegen/UnsafeMixed.ts +9 -0
  246. package/src/utils/index.ts +1 -14
  247. package/android/src/main/java/org/maplibre/reactnative/components/AbstractEvent.java +0 -35
  248. package/android/src/main/java/org/maplibre/reactnative/components/AbstractEventEmitter.java +0 -80
  249. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraStop.java +0 -245
  250. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateItem.java +0 -121
  251. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateQueue.java +0 -68
  252. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.java +0 -519
  253. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraManager.java +0 -101
  254. package/android/src/main/java/org/maplibre/reactnative/components/camera/constants/CameraMode.java +0 -18
  255. package/android/src/main/java/org/maplibre/reactnative/components/mapview/LayerSourceInfo.java +0 -59
  256. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapView.java +0 -13
  257. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapViewManager.java +0 -27
  258. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.java +0 -1521
  259. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.java +0 -342
  260. package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/CameraChangeTracker.java +0 -37
  261. package/android/src/main/java/org/maplibre/reactnative/events/MapChangeEvent.java +0 -43
  262. package/android/src/main/java/org/maplibre/reactnative/events/MapUserTrackingModeEvent.java +0 -32
  263. package/android/src/main/java/org/maplibre/reactnative/location/UserLocationVerticalAlignment.java +0 -7
  264. package/android/src/main/java/org/maplibre/reactnative/location/UserTrackingMode.java +0 -59
  265. package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.java +0 -310
  266. package/ios/CameraMode.h +0 -10
  267. package/ios/CameraMode.m +0 -10
  268. package/ios/CameraStop.m +0 -73
  269. package/ios/MLRNCamera.h +0 -29
  270. package/ios/MLRNCamera.m +0 -236
  271. package/ios/MLRNCameraManager.h +0 -5
  272. package/ios/MLRNCameraManager.m +0 -39
  273. package/ios/MLRNMapView.m +0 -497
  274. package/ios/MLRNMapViewManager.h +0 -9
  275. package/ios/MLRNMapViewManager.m +0 -604
  276. package/lib/commonjs/MapLibreRN.js +0 -266
  277. package/lib/commonjs/MapLibreRN.js.map +0 -1
  278. package/lib/commonjs/components/Camera.js +0 -333
  279. package/lib/commonjs/components/Camera.js.map +0 -1
  280. package/lib/commonjs/components/MapView.js +0 -449
  281. package/lib/commonjs/components/MapView.js.map +0 -1
  282. package/lib/commonjs/hooks/useNativeRef.js +0 -14
  283. package/lib/commonjs/hooks/useNativeRef.js.map +0 -1
  284. package/lib/commonjs/types/CameraMode.js +0 -14
  285. package/lib/commonjs/types/CameraMode.js.map +0 -1
  286. package/lib/commonjs/types/MapLibreRNEvent.js +0 -6
  287. package/lib/commonjs/types/OnPressEvent.js +0 -2
  288. package/lib/module/MapLibreRN.js +0 -33
  289. package/lib/module/MapLibreRN.js.map +0 -1
  290. package/lib/module/components/Camera.js +0 -328
  291. package/lib/module/components/Camera.js.map +0 -1
  292. package/lib/module/components/MapView.js +0 -444
  293. package/lib/module/components/MapView.js.map +0 -1
  294. package/lib/module/hooks/useNativeRef.js +0 -10
  295. package/lib/module/hooks/useNativeRef.js.map +0 -1
  296. package/lib/module/types/CameraMode.js +0 -10
  297. package/lib/module/types/CameraMode.js.map +0 -1
  298. package/lib/module/types/MapLibreRNEvent.js +0 -4
  299. package/lib/module/types/OnPressEvent.js +0 -2
  300. package/lib/typescript/commonjs/src/MapLibreRN.d.ts +0 -41
  301. package/lib/typescript/commonjs/src/MapLibreRN.d.ts.map +0 -1
  302. package/lib/typescript/commonjs/src/components/Camera.d.ts +0 -134
  303. package/lib/typescript/commonjs/src/components/Camera.d.ts.map +0 -1
  304. package/lib/typescript/commonjs/src/components/MapView.d.ts +0 -223
  305. package/lib/typescript/commonjs/src/components/MapView.d.ts.map +0 -1
  306. package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts +0 -8
  307. package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts.map +0 -1
  308. package/lib/typescript/commonjs/src/types/CameraMode.d.ts +0 -7
  309. package/lib/typescript/commonjs/src/types/CameraMode.d.ts.map +0 -1
  310. package/lib/typescript/commonjs/src/types/MapLibreRNEvent.d.ts +0 -6
  311. package/lib/typescript/commonjs/src/types/MapLibreRNEvent.d.ts.map +0 -1
  312. package/lib/typescript/commonjs/src/types/OnPressEvent.d.ts +0 -12
  313. package/lib/typescript/commonjs/src/types/OnPressEvent.d.ts.map +0 -1
  314. package/lib/typescript/module/src/MapLibreRN.d.ts +0 -41
  315. package/lib/typescript/module/src/MapLibreRN.d.ts.map +0 -1
  316. package/lib/typescript/module/src/components/Camera.d.ts +0 -134
  317. package/lib/typescript/module/src/components/Camera.d.ts.map +0 -1
  318. package/lib/typescript/module/src/components/MapView.d.ts +0 -223
  319. package/lib/typescript/module/src/components/MapView.d.ts.map +0 -1
  320. package/lib/typescript/module/src/hooks/useNativeRef.d.ts +0 -8
  321. package/lib/typescript/module/src/hooks/useNativeRef.d.ts.map +0 -1
  322. package/lib/typescript/module/src/types/CameraMode.d.ts +0 -7
  323. package/lib/typescript/module/src/types/CameraMode.d.ts.map +0 -1
  324. package/lib/typescript/module/src/types/MapLibreRNEvent.d.ts +0 -6
  325. package/lib/typescript/module/src/types/MapLibreRNEvent.d.ts.map +0 -1
  326. package/lib/typescript/module/src/types/OnPressEvent.d.ts +0 -12
  327. package/lib/typescript/module/src/types/OnPressEvent.d.ts.map +0 -1
  328. package/src/MapLibreRN.ts +0 -75
  329. package/src/components/Camera.tsx +0 -568
  330. package/src/components/MapView.tsx +0 -838
  331. package/src/hooks/useNativeRef.ts +0 -14
  332. package/src/types/CameraMode.ts +0 -6
  333. package/src/types/MapLibreRNEvent.ts +0 -7
  334. package/src/types/OnPressEvent.ts +0 -11
  335. /package/ios/{CameraUpdateItem.h → components/camera/CameraUpdateItem.h} +0 -0
  336. /package/ios/{CameraUpdateQueue.h → components/camera/CameraUpdateQueue.h} +0 -0
  337. /package/ios/{CameraUpdateQueue.m → components/camera/CameraUpdateQueue.m} +0 -0
  338. /package/ios/{MLRNSnapshotModule → modules/snapshot}/MLRNSnapshotModule.h +0 -0
@@ -1,39 +0,0 @@
1
- #import "MLRNCameraManager.h"
2
- #import "MLRNCamera.h"
3
-
4
- @implementation MLRNCameraManager
5
-
6
- RCT_EXPORT_MODULE(MLRNCamera)
7
-
8
- #pragma - View Properties
9
-
10
- RCT_EXPORT_VIEW_PROPERTY(stop, NSDictionary)
11
-
12
- RCT_EXPORT_VIEW_PROPERTY(followUserLocation, BOOL)
13
- RCT_EXPORT_VIEW_PROPERTY(followUserMode, NSString)
14
- RCT_EXPORT_VIEW_PROPERTY(followZoomLevel, NSNumber)
15
- RCT_EXPORT_VIEW_PROPERTY(followPitch, NSNumber)
16
- RCT_EXPORT_VIEW_PROPERTY(followHeading, NSNumber)
17
-
18
- RCT_EXPORT_VIEW_PROPERTY(alignment, NSString)
19
-
20
- RCT_EXPORT_VIEW_PROPERTY(maxBounds, NSString)
21
-
22
- RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, NSNumber)
23
- RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, NSNumber)
24
-
25
- RCT_EXPORT_VIEW_PROPERTY(onUserTrackingModeChange, RCTBubblingEventBlock)
26
-
27
- RCT_EXPORT_VIEW_PROPERTY(defaultStop, NSDictionary)
28
-
29
- #pragma Methods
30
-
31
- - (BOOL)requiresMainQueueSetup {
32
- return YES;
33
- }
34
-
35
- - (UIView *)view {
36
- return [[MLRNCamera alloc] init];
37
- }
38
-
39
- @end
package/ios/MLRNMapView.m DELETED
@@ -1,497 +0,0 @@
1
- #import "MLRNMapView.h"
2
- #import <React/UIView+React.h>
3
- #import "CameraUpdateQueue.h"
4
- #import "MLRNImageUtils.h"
5
- #import "MLRNImages.h"
6
- #import "MLRNLogging.h"
7
- #import "MLRNNativeUserLocation.h"
8
- #import "MLRNUtils.h"
9
-
10
- @implementation MLRNMapView {
11
- BOOL _pendingInitialLayout;
12
- }
13
-
14
- static double const DEG2RAD = M_PI / 180;
15
- static double const LAT_MAX = 85.051128779806604;
16
- static double const TILE_SIZE = 256;
17
- static double const EARTH_RADIUS_M = 6378137;
18
- static double const M2PI = M_PI * 2;
19
-
20
- - (instancetype)initWithFrame:(CGRect)frame {
21
- if (self = [super initWithFrame:frame]) {
22
- _pendingInitialLayout = YES;
23
- _cameraUpdateQueue = [[CameraUpdateQueue alloc] init];
24
- _sources = [[NSMutableArray alloc] init];
25
- _images = [[NSMutableArray alloc] init];
26
- _layers = [[NSMutableArray alloc] init];
27
- _pointAnnotations = [[NSMutableArray alloc] init];
28
- _reactSubviews = [[NSMutableArray alloc] init];
29
- _layerWaiters = [[NSMutableDictionary alloc] init];
30
- _styleWaiters = [[NSMutableArray alloc] init];
31
- _logging = [[MLRNLogging alloc] init];
32
- }
33
- return self;
34
- }
35
-
36
- - (void)layoutSubviews {
37
- [super layoutSubviews];
38
- if (_pendingInitialLayout) {
39
- _pendingInitialLayout = NO;
40
-
41
- [_reactCamera initialLayout];
42
- }
43
- }
44
-
45
- - (void)invalidate {
46
- if (_reactSubviews.count == 0) {
47
- return;
48
- }
49
- for (int i = 0; i < _reactSubviews.count; i++) {
50
- [self removeFromMap:_reactSubviews[i]];
51
- }
52
- }
53
-
54
- - (void)layerAdded:(MLNStyleLayer *)layer {
55
- NSString *layerID = layer.identifier;
56
- NSMutableArray *waiters = [_layerWaiters valueForKey:layerID];
57
- if (waiters) {
58
- for (FoundLayerBlock foundLayerBlock in waiters) {
59
- foundLayerBlock(layer);
60
- }
61
- [_layerWaiters removeObjectForKey:layerID];
62
- }
63
- }
64
-
65
- - (void)waitForLayerWithID:(nonnull NSString *)layerID
66
- then:(void (^)(MLNStyleLayer *layer))foundLayer {
67
- if (self.style) {
68
- MLNStyleLayer *layer = [self.style layerWithIdentifier:layerID];
69
- if (layer) {
70
- foundLayer(layer);
71
- } else {
72
- NSMutableArray *existingWaiters = [_layerWaiters valueForKey:layerID];
73
-
74
- NSMutableArray *waiters = existingWaiters;
75
- if (waiters == nil) {
76
- waiters = [[NSMutableArray alloc] init];
77
- }
78
- [waiters addObject:foundLayer];
79
- if (!existingWaiters) {
80
- [_layerWaiters setObject:waiters forKey:layerID];
81
- }
82
- }
83
- } else {
84
- // TODO
85
- }
86
- }
87
-
88
- - (void)getStyle:(void (^)(MLNStyle *style))onStyleLoaded {
89
- if (self.style) {
90
- onStyleLoaded(self.style);
91
- } else {
92
- [_styleWaiters addObject:onStyleLoaded];
93
- }
94
- }
95
-
96
- - (void)notifyStyleLoaded {
97
- if (!self.style) return;
98
- for (StyleLoadedBlock styleLoadedBlock in self.styleWaiters) {
99
- styleLoadedBlock(self.style);
100
- }
101
- [self.styleWaiters removeAllObjects];
102
- }
103
-
104
- - (void)addToMap:(id<RCTComponent>)subview {
105
- if ([subview isKindOfClass:[MLRNSource class]]) {
106
- MLRNSource *source = (MLRNSource *)subview;
107
- source.map = self;
108
- [_sources addObject:(MLRNSource *)subview];
109
- } else if ([subview isKindOfClass:[MLRNLight class]]) {
110
- MLRNLight *light = (MLRNLight *)subview;
111
- _light = light;
112
- _light.map = self;
113
- } else if ([subview isKindOfClass:[MLRNNativeUserLocation class]]) {
114
- MLRNNativeUserLocation *nativeUserLocation = (MLRNNativeUserLocation *)subview;
115
- nativeUserLocation.map = self;
116
- } else if ([subview isKindOfClass:[MLRNPointAnnotation class]]) {
117
- MLRNPointAnnotation *pointAnnotation = (MLRNPointAnnotation *)subview;
118
- pointAnnotation.map = self;
119
- [_pointAnnotations addObject:pointAnnotation];
120
- } else if ([subview isKindOfClass:[MLRNCamera class]]) {
121
- MLRNCamera *camera = (MLRNCamera *)subview;
122
- camera.map = self;
123
- } else if ([subview isKindOfClass:[MLRNImages class]]) {
124
- MLRNImages *images = (MLRNImages *)subview;
125
- images.map = self;
126
- [_images addObject:images];
127
- } else if ([subview isKindOfClass:[MLRNLayer class]]) {
128
- MLRNLayer *layer = (MLRNLayer *)subview;
129
- layer.map = self;
130
- [_layers addObject:layer];
131
- } else {
132
- NSArray<id<RCTComponent>> *childSubviews = [subview reactSubviews];
133
-
134
- for (int i = 0; i < childSubviews.count; i++) {
135
- [self addToMap:childSubviews[i]];
136
- }
137
- }
138
- }
139
-
140
- - (void)removeFromMap:(id<RCTComponent>)subview {
141
- if ([subview isKindOfClass:[MLRNSource class]]) {
142
- MLRNSource *source = (MLRNSource *)subview;
143
- source.map = nil;
144
- [_sources removeObject:source];
145
- } else if ([subview isKindOfClass:[MLRNPointAnnotation class]]) {
146
- MLRNPointAnnotation *pointAnnotation = (MLRNPointAnnotation *)subview;
147
- pointAnnotation.map = nil;
148
- [_pointAnnotations removeObject:pointAnnotation];
149
- } else if ([subview isKindOfClass:[MLRNCamera class]]) {
150
- MLRNCamera *camera = (MLRNCamera *)subview;
151
- camera.map = nil;
152
- } else if ([subview isKindOfClass:[MLRNImages class]]) {
153
- MLRNImages *images = (MLRNImages *)subview;
154
- images.map = nil;
155
- [_images removeObject:images];
156
- } else if ([subview isKindOfClass:[MLRNLayer class]]) {
157
- MLRNLayer *layer = (MLRNLayer *)subview;
158
- layer.map = nil;
159
- [_layers removeObject:layer];
160
- } else if ([subview isKindOfClass:[MLRNNativeUserLocation class]]) {
161
- MLRNNativeUserLocation *nativeUserLocation = (MLRNNativeUserLocation *)subview;
162
- nativeUserLocation.map = nil;
163
- } else if ([subview isKindOfClass:[MLRNLight class]]) {
164
- MLRNLight *light = (MLRNLight *)subview;
165
- light.map = nil;
166
- } else {
167
- NSArray<id<RCTComponent>> *childSubViews = [subview reactSubviews];
168
-
169
- for (int i = 0; i < childSubViews.count; i++) {
170
- [self removeFromMap:childSubViews[i]];
171
- }
172
- }
173
- if ([_layerWaiters count] > 0) {
174
- RCTLogWarn(@"The following layers were waited on but never added to the map: %@",
175
- [_layerWaiters allKeys]);
176
- [_layerWaiters removeAllObjects];
177
- }
178
- }
179
-
180
- - (void)setSourceVisibility:(BOOL)visible
181
- sourceId:(NSString *)sourceId
182
- sourceLayerId:(NSString *)sourceLayerId {
183
- __weak typeof(self) weakSelf = self;
184
- [self getStyle:^(MLNStyle *style) {
185
- __strong typeof(self) strongSelf = weakSelf;
186
- for (MLNStyleLayer *layer in strongSelf.style.layers) {
187
- if ([layer isKindOfClass:[MLNForegroundStyleLayer class]]) {
188
- MLNForegroundStyleLayer *foregroundLayer = (MLNForegroundStyleLayer *)layer;
189
- if (![foregroundLayer.sourceIdentifier isEqualToString:sourceId]) continue;
190
- if (sourceLayerId == nil || sourceLayerId.length == 0) {
191
- layer.visible = visible;
192
- } else if ([layer isKindOfClass:[MLNVectorStyleLayer class]]) {
193
- MLNVectorStyleLayer *vectorLayer = (MLNVectorStyleLayer *)layer;
194
- if ([vectorLayer.sourceLayerIdentifier isEqualToString:sourceLayerId]) {
195
- layer.visible = visible;
196
- }
197
- }
198
- }
199
- }
200
- }];
201
- }
202
-
203
- #pragma clang diagnostic push
204
- #pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
205
- - (void)insertReactSubview:(id<RCTComponent>)subview atIndex:(NSInteger)atIndex {
206
- [self addToMap:subview];
207
- [_reactSubviews insertObject:(UIView *)subview atIndex:(NSUInteger)atIndex];
208
- }
209
- #pragma clang diagnostic pop
210
-
211
- #pragma clang diagnostic push
212
- #pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
213
- - (void)removeReactSubview:(id<RCTComponent>)subview {
214
- // similarly, when the children are being removed we have to do the appropriate
215
- // underlying mapview action here.
216
- [self removeFromMap:subview];
217
- [_reactSubviews removeObject:(UIView *)subview];
218
- [(UIView *)subview removeFromSuperview];
219
- }
220
- #pragma clang diagnostic pop
221
-
222
- #pragma clang diagnostic push
223
- #pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
224
- - (NSArray<id<RCTComponent>> *)reactSubviews {
225
- return _reactSubviews;
226
- }
227
- #pragma clang diagnostic pop
228
-
229
- - (void)setReactZoomEnabled:(BOOL)reactZoomEnabled {
230
- _reactZoomEnabled = reactZoomEnabled;
231
- self.zoomEnabled = _reactZoomEnabled;
232
- }
233
-
234
- - (void)setReactScrollEnabled:(BOOL)reactScrollEnabled {
235
- _reactScrollEnabled = reactScrollEnabled;
236
- self.scrollEnabled = _reactScrollEnabled;
237
- }
238
-
239
- - (void)setReactPitchEnabled:(BOOL)reactPitchEnabled {
240
- _reactPitchEnabled = reactPitchEnabled;
241
- self.pitchEnabled = _reactPitchEnabled;
242
- }
243
-
244
- - (void)setReactRotateEnabled:(BOOL)reactRotateEnabled {
245
- _reactRotateEnabled = reactRotateEnabled;
246
- self.rotateEnabled = _reactRotateEnabled;
247
- }
248
-
249
- - (void)setReactAttributionEnabled:(BOOL)reactAttributionEnabled {
250
- _reactAttributionEnabled = reactAttributionEnabled;
251
- self.attributionButton.hidden = !_reactAttributionEnabled;
252
- }
253
-
254
- - (void)setReactAttributionPosition:(NSDictionary<NSString *, NSNumber *> *)position {
255
- NSNumber *left = [position valueForKey:@"left"];
256
- NSNumber *right = [position valueForKey:@"right"];
257
- NSNumber *top = [position valueForKey:@"top"];
258
- NSNumber *bottom = [position valueForKey:@"bottom"];
259
- if (left != nil && top != nil) {
260
- [self setAttributionButtonPosition:MLNOrnamentPositionTopLeft];
261
- [self setAttributionButtonMargins:CGPointMake([left floatValue], [top floatValue])];
262
- } else if (right != nil && top != nil) {
263
- [self setAttributionButtonPosition:MLNOrnamentPositionTopRight];
264
- [self setAttributionButtonMargins:CGPointMake([right floatValue], [top floatValue])];
265
- } else if (bottom != nil && right != nil) {
266
- [self setAttributionButtonPosition:MLNOrnamentPositionBottomRight];
267
- [self setAttributionButtonMargins:CGPointMake([right floatValue], [bottom floatValue])];
268
- } else if (bottom != nil && left != nil) {
269
- [self setAttributionButtonPosition:MLNOrnamentPositionBottomLeft];
270
- [self setAttributionButtonMargins:CGPointMake([left floatValue], [bottom floatValue])];
271
- } else {
272
- [self setAttributionButtonPosition:MLNOrnamentPositionBottomRight];
273
- // same as MLNOrnamentDefaultPositionOffset in MLNMapView.mm
274
- [self setAttributionButtonMargins:CGPointMake(8, 8)];
275
- }
276
- }
277
-
278
- - (void)setReactLogoEnabled:(BOOL)reactLogoEnabled {
279
- _reactLogoEnabled = reactLogoEnabled;
280
- self.logoView.hidden = !_reactLogoEnabled;
281
- }
282
-
283
- - (void)setReactLogoPosition:(NSDictionary<NSString *, NSNumber *> *)logoPosition {
284
- NSNumber *left = [logoPosition valueForKey:@"left"];
285
- NSNumber *right = [logoPosition valueForKey:@"right"];
286
- NSNumber *top = [logoPosition valueForKey:@"top"];
287
- NSNumber *bottom = [logoPosition valueForKey:@"bottom"];
288
- if (left != nil && top != nil) {
289
- [self setLogoViewPosition:MLNOrnamentPositionTopLeft];
290
- [self setLogoViewMargins:CGPointMake([left floatValue], [top floatValue])];
291
- } else if (right != nil && top != nil) {
292
- [self setLogoViewPosition:MLNOrnamentPositionTopRight];
293
- [self setLogoViewMargins:CGPointMake([right floatValue], [top floatValue])];
294
- } else if (bottom != nil && right != nil) {
295
- [self setLogoViewPosition:MLNOrnamentPositionBottomRight];
296
- [self setLogoViewMargins:CGPointMake([right floatValue], [bottom floatValue])];
297
- } else if (bottom != nil && left != nil) {
298
- [self setLogoViewPosition:MLNOrnamentPositionBottomLeft];
299
- [self setLogoViewMargins:CGPointMake([left floatValue], [bottom floatValue])];
300
- } else {
301
- [self setLogoViewPosition:MLNOrnamentPositionBottomRight];
302
- [self setLogoViewMargins:CGPointMake(8, 8)];
303
- }
304
- }
305
-
306
- - (void)setReactCompassEnabled:(BOOL)reactCompassEnabled {
307
- _reactCompassEnabled = reactCompassEnabled;
308
- self.compassView.hidden = !_reactCompassEnabled;
309
- }
310
-
311
- - (void)setReactCompassViewPosition:(NSInteger)reactCompassViewPosition {
312
- if (!self.compassView.hidden) {
313
- _reactCompassViewPosition = reactCompassViewPosition;
314
- self.compassViewPosition = _reactCompassViewPosition;
315
- }
316
- }
317
-
318
- - (void)setReactCompassViewMargins:(CGPoint)reactCompassViewMargins {
319
- if (!self.compassView.hidden) {
320
- CGPoint point;
321
- point = reactCompassViewMargins;
322
- self.compassViewMargins = point;
323
- }
324
- }
325
-
326
- - (void)setReactShowUserLocation:(BOOL)reactShowUserLocation {
327
- // FMTODO
328
- //_reactShowUserLocation = reactShowUserLocation;
329
- self.showsUserLocation = reactShowUserLocation; //_reactShowUserLocation;
330
- }
331
-
332
- - (void)setReactContentInset:(NSArray<NSNumber *> *)reactContentInset {
333
- CGFloat top = 0.0f, right = 0.0f, left = 0.0f, bottom = 0.0f;
334
-
335
- if (reactContentInset.count == 4) {
336
- top = [reactContentInset[0] floatValue];
337
- right = [reactContentInset[1] floatValue];
338
- bottom = [reactContentInset[2] floatValue];
339
- left = [reactContentInset[3] floatValue];
340
- } else if (reactContentInset.count == 2) {
341
- top = [reactContentInset[0] floatValue];
342
- right = [reactContentInset[1] floatValue];
343
- bottom = [reactContentInset[0] floatValue];
344
- left = [reactContentInset[1] floatValue];
345
- } else if (reactContentInset.count == 1) {
346
- top = [reactContentInset[0] floatValue];
347
- right = [reactContentInset[0] floatValue];
348
- bottom = [reactContentInset[0] floatValue];
349
- left = [reactContentInset[0] floatValue];
350
- }
351
-
352
- self.contentInset = UIEdgeInsetsMake(top, left, bottom, right);
353
- }
354
-
355
- - (void)setReactMapStyle:(NSString *)reactMapStyle {
356
- _reactMapStyle = reactMapStyle;
357
- [self _removeAllSourcesFromMap];
358
- self.styleURL = [self _getStyleURLFromKey:_reactMapStyle];
359
- }
360
-
361
- - (void)setReactPreferredFramesPerSecond:(NSInteger)reactPreferredFramesPerSecond {
362
- self.preferredFramesPerSecond = reactPreferredFramesPerSecond;
363
- }
364
-
365
- #pragma mark - methods
366
-
367
- - (NSString *)takeSnap:(BOOL)writeToDisk {
368
- UIGraphicsBeginImageContextWithOptions(self.bounds.size, YES, 0);
369
- [self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES];
370
- UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext();
371
- UIGraphicsEndImageContext();
372
- return writeToDisk ? [MLRNImageUtils createTempFile:snapshot]
373
- : [MLRNImageUtils createBase64:snapshot];
374
- }
375
-
376
- - (CLLocationDistance)getMetersPerPixelAtLatitude:(double)latitude withZoom:(double)zoomLevel {
377
- double constrainedZoom =
378
- [[MLRNUtils clamp:[NSNumber numberWithDouble:zoomLevel]
379
- min:[NSNumber numberWithDouble:self.minimumZoomLevel]
380
- max:[NSNumber numberWithDouble:self.maximumZoomLevel]] doubleValue];
381
-
382
- double constrainedLatitude = [[MLRNUtils clamp:[NSNumber numberWithDouble:latitude]
383
- min:[NSNumber numberWithDouble:-LAT_MAX]
384
- max:[NSNumber numberWithDouble:LAT_MAX]] doubleValue];
385
-
386
- double constrainedScale = pow(2.0, constrainedZoom);
387
- return cos(constrainedLatitude * DEG2RAD) * M2PI * EARTH_RADIUS_M /
388
- (constrainedScale * TILE_SIZE);
389
- }
390
-
391
- - (CLLocationDistance)altitudeFromZoom:(double)zoomLevel {
392
- return [self altitudeFromZoom:zoomLevel atLatitude:self.camera.centerCoordinate.latitude];
393
- }
394
-
395
- - (CLLocationDistance)altitudeFromZoom:(double)zoomLevel atLatitude:(CLLocationDegrees)latitude {
396
- return [self altitudeFromZoom:zoomLevel atLatitude:latitude atPitch:self.camera.pitch];
397
- }
398
-
399
- - (CLLocationDistance)altitudeFromZoom:(double)zoomLevel
400
- atLatitude:(CLLocationDegrees)latitude
401
- atPitch:(CGFloat)pitch {
402
- return MLNAltitudeForZoomLevel(zoomLevel, pitch, latitude, self.frame.size);
403
- }
404
-
405
- - (MLRNPointAnnotation *)getRCTPointAnnotation:(MLNPointAnnotation *)mlnAnnotation {
406
- for (int i = 0; i < _pointAnnotations.count; i++) {
407
- MLRNPointAnnotation *rctAnnotation = _pointAnnotations[i];
408
- if (rctAnnotation.annotation == mlnAnnotation) {
409
- return rctAnnotation;
410
- }
411
- }
412
- return nil;
413
- }
414
-
415
- - (NSArray<MLRNSource *> *)getAllTouchableSources {
416
- NSMutableArray<MLRNSource *> *touchableSources = [[NSMutableArray alloc] init];
417
-
418
- for (MLRNSource *source in _sources) {
419
- if (source.hasPressListener) {
420
- [touchableSources addObject:source];
421
- }
422
- }
423
-
424
- return touchableSources;
425
- }
426
-
427
- - (NSArray<MLRNImages *> *)getAllImages {
428
- return [_images copy];
429
- }
430
-
431
- - (NSArray<MLRNShapeSource *> *)getAllShapeSources {
432
- NSMutableArray<MLRNSource *> *shapeSources = [[NSMutableArray alloc] init];
433
-
434
- for (MLRNSource *source in _sources) {
435
- if ([source isKindOfClass:[MLRNShapeSource class]]) {
436
- [shapeSources addObject:(MLRNShapeSource *)source];
437
- }
438
- }
439
-
440
- return [shapeSources copy];
441
- }
442
- - (MLRNSource *)getTouchableSourceWithHighestZIndex:(NSArray<MLRNSource *> *)touchableSources {
443
- if (touchableSources == nil || touchableSources.count == 0) {
444
- return nil;
445
- }
446
-
447
- if (touchableSources.count == 1) {
448
- return touchableSources[0];
449
- }
450
-
451
- NSMutableDictionary<NSString *, MLRNSource *> *layerToSoureDict =
452
- [[NSMutableDictionary alloc] init];
453
- for (MLRNSource *touchableSource in touchableSources) {
454
- NSArray<NSString *> *layerIDs = [touchableSource getLayerIDs];
455
-
456
- for (NSString *layerID in layerIDs) {
457
- layerToSoureDict[layerID] = touchableSource;
458
- }
459
- }
460
-
461
- NSArray<MLNStyleLayer *> *layers = self.style.layers;
462
- for (int i = (int)layers.count - 1; i >= 0; i--) {
463
- MLNStyleLayer *layer = layers[i];
464
-
465
- MLRNSource *source = layerToSoureDict[layer.identifier];
466
- if (source != nil) {
467
- return source;
468
- }
469
- }
470
-
471
- return nil;
472
- }
473
-
474
- - (NSURL *)_getStyleURLFromKey:(NSString *)mapStyle {
475
- NSURL *url = [NSURL URLWithString:mapStyle];
476
- if (url) {
477
- return url;
478
- } else if (RCTJSONParse(mapStyle, nil)) {
479
- return [MLRNUtils styleURLFromStyleJSON:mapStyle];
480
- }
481
- return url;
482
- }
483
-
484
- - (void)_removeAllSourcesFromMap {
485
- if (self.style == nil || _sources.count == 0) {
486
- return;
487
- }
488
- for (MLRNSource *source in _sources) {
489
- source.map = nil;
490
- }
491
- }
492
-
493
- - (void)didChangeUserTrackingMode:(MLNUserTrackingMode)mode animated:(BOOL)animated {
494
- [_reactCamera didChangeUserTrackingMode:mode animated:animated];
495
- }
496
-
497
- @end
@@ -1,9 +0,0 @@
1
- #import "ViewManager.h"
2
- @import MapLibre;
3
-
4
- @interface MLRNMapViewManager : ViewManager
5
-
6
- - (void)didTapMap:(UITapGestureRecognizer *)recognizer;
7
- - (void)didLongPressMap:(UILongPressGestureRecognizer *)recognizer;
8
-
9
- @end