@lugg/maps 1.0.0-beta.2 → 1.0.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/README.md +3 -0
  2. package/android/src/main/java/com/luggmaps/LuggCalloutView.kt +9 -2
  3. package/android/src/main/java/com/luggmaps/LuggCalloutViewManager.kt +4 -3
  4. package/android/src/main/java/com/luggmaps/LuggCircleView.kt +85 -0
  5. package/android/src/main/java/com/luggmaps/LuggCircleViewManager.kt +79 -0
  6. package/android/src/main/java/com/luggmaps/LuggGroundOverlayView.kt +81 -0
  7. package/android/src/main/java/com/luggmaps/LuggGroundOverlayViewManager.kt +82 -0
  8. package/android/src/main/java/com/luggmaps/LuggMapView.kt +90 -0
  9. package/android/src/main/java/com/luggmaps/LuggMapViewManager.kt +45 -0
  10. package/android/src/main/java/com/luggmaps/LuggMapWrapperView.kt +27 -2
  11. package/android/src/main/java/com/luggmaps/LuggMarkerView.kt +30 -2
  12. package/android/src/main/java/com/luggmaps/LuggMarkerViewManager.kt +13 -0
  13. package/android/src/main/java/com/luggmaps/LuggPackage.kt +4 -1
  14. package/android/src/main/java/com/luggmaps/LuggPolylineView.kt +3 -23
  15. package/android/src/main/java/com/luggmaps/LuggTileOverlayView.kt +92 -0
  16. package/android/src/main/java/com/luggmaps/LuggTileOverlayViewManager.kt +80 -0
  17. package/android/src/main/java/com/luggmaps/core/GoogleMapProvider.kt +676 -36
  18. package/android/src/main/java/com/luggmaps/core/MapProviderDelegate.kt +15 -0
  19. package/android/src/main/java/com/luggmaps/core/PolylineAnimator.kt +65 -11
  20. package/android/src/main/java/com/luggmaps/events/CirclePressEvent.kt +12 -0
  21. package/android/src/main/java/com/luggmaps/events/GroundOverlayPressEvent.kt +12 -0
  22. package/android/src/main/java/com/luggmaps/events/TileOverlayPressEvent.kt +12 -0
  23. package/android/src/main/java/com/luggmaps/extensions/ViewExtensions.kt +11 -0
  24. package/ios/LuggCalloutView.h +1 -1
  25. package/ios/LuggCalloutView.mm +21 -11
  26. package/ios/LuggCircleView.h +31 -0
  27. package/ios/LuggCircleView.mm +133 -0
  28. package/ios/LuggGroundOverlayView.h +30 -0
  29. package/ios/LuggGroundOverlayView.mm +125 -0
  30. package/ios/LuggMapView.mm +254 -4
  31. package/ios/LuggMapWrapperView.h +5 -0
  32. package/ios/LuggMapWrapperView.mm +18 -0
  33. package/ios/LuggMarkerView.h +3 -0
  34. package/ios/LuggMarkerView.mm +25 -0
  35. package/ios/LuggTileOverlayView.h +31 -0
  36. package/ios/LuggTileOverlayView.mm +130 -0
  37. package/ios/core/AppleMapProvider.h +8 -0
  38. package/ios/core/AppleMapProvider.mm +663 -29
  39. package/ios/core/AppleStaticMapProvider.h +14 -0
  40. package/ios/core/AppleStaticMapProvider.mm +159 -0
  41. package/ios/core/GMSPolylineAnimator.m +46 -18
  42. package/ios/core/GoogleMapProvider.h +10 -0
  43. package/ios/core/GoogleMapProvider.mm +430 -51
  44. package/ios/core/GoogleStaticMapProvider.h +21 -0
  45. package/ios/core/GoogleStaticMapProvider.mm +213 -0
  46. package/ios/core/MKPolylineAnimator.m +67 -43
  47. package/ios/core/MapProviderDelegate.h +27 -1
  48. package/ios/core/StaticMapProviderBase.h +75 -0
  49. package/ios/core/StaticMapProviderBase.mm +845 -0
  50. package/ios/events/CameraIdleEvent.h +4 -2
  51. package/ios/events/CameraMoveEvent.h +4 -2
  52. package/ios/events/CirclePressEvent.h +22 -0
  53. package/ios/events/GroundOverlayPressEvent.h +22 -0
  54. package/ios/events/LongPressEvent.h +4 -2
  55. package/ios/events/MarkerDragEvent.h +12 -6
  56. package/ios/events/MarkerPressEvent.h +4 -2
  57. package/ios/events/PolygonPressEvent.h +4 -2
  58. package/ios/events/PressEvent.h +4 -2
  59. package/ios/events/ReadyEvent.h +4 -2
  60. package/ios/events/TileOverlayPressEvent.h +22 -0
  61. package/ios/extensions/MKMapView+Zoom.h +20 -0
  62. package/ios/extensions/MKMapView+Zoom.m +28 -18
  63. package/ios/extensions/UIView+Snapshot.h +16 -0
  64. package/ios/extensions/UIView+Snapshot.m +27 -0
  65. package/lib/module/MapProvider.web.js +4 -1
  66. package/lib/module/MapProvider.web.js.map +1 -1
  67. package/lib/module/MapView.js +19 -1
  68. package/lib/module/MapView.js.map +1 -1
  69. package/lib/module/MapView.web.js +30 -22
  70. package/lib/module/MapView.web.js.map +1 -1
  71. package/lib/module/components/Circle.js +46 -0
  72. package/lib/module/components/Circle.js.map +1 -0
  73. package/lib/module/components/Circle.types.js +4 -0
  74. package/lib/module/components/Circle.types.js.map +1 -0
  75. package/lib/module/components/Circle.web.js +79 -0
  76. package/lib/module/components/Circle.web.js.map +1 -0
  77. package/lib/module/components/GeoJson.js +3 -3
  78. package/lib/module/components/GeoJson.js.map +1 -1
  79. package/lib/module/components/GroundOverlay.js +45 -0
  80. package/lib/module/components/GroundOverlay.js.map +1 -0
  81. package/lib/module/components/GroundOverlay.types.js +4 -0
  82. package/lib/module/components/GroundOverlay.types.js.map +1 -0
  83. package/lib/module/components/GroundOverlay.web.js +77 -0
  84. package/lib/module/components/GroundOverlay.web.js.map +1 -0
  85. package/lib/module/components/Marker.js +22 -4
  86. package/lib/module/components/Marker.js.map +1 -1
  87. package/lib/module/components/Marker.web.js +23 -10
  88. package/lib/module/components/Marker.web.js.map +1 -1
  89. package/lib/module/components/Polygon.web.js +3 -3
  90. package/lib/module/components/Polygon.web.js.map +1 -1
  91. package/lib/module/components/Polyline.web.js +6 -12
  92. package/lib/module/components/Polyline.web.js.map +1 -1
  93. package/lib/module/components/TileOverlay.js +44 -0
  94. package/lib/module/components/TileOverlay.js.map +1 -0
  95. package/lib/module/components/TileOverlay.types.js +4 -0
  96. package/lib/module/components/TileOverlay.types.js.map +1 -0
  97. package/lib/module/components/TileOverlay.web.js +69 -0
  98. package/lib/module/components/TileOverlay.web.js.map +1 -0
  99. package/lib/module/components/index.js +3 -0
  100. package/lib/module/components/index.js.map +1 -1
  101. package/lib/module/components/index.web.js +3 -0
  102. package/lib/module/components/index.web.js.map +1 -1
  103. package/lib/module/fabric/LuggCalloutViewNativeComponent.ts +1 -1
  104. package/lib/module/fabric/LuggCircleViewNativeComponent.ts +25 -0
  105. package/lib/module/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
  106. package/lib/module/fabric/LuggMapViewNativeComponent.ts +16 -5
  107. package/lib/module/fabric/LuggMarkerViewNativeComponent.ts +14 -2
  108. package/lib/module/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
  109. package/lib/module/index.js +3 -0
  110. package/lib/module/index.js.map +1 -1
  111. package/lib/module/index.web.js +3 -0
  112. package/lib/module/index.web.js.map +1 -1
  113. package/lib/typescript/src/MapProvider.web.d.ts +3 -2
  114. package/lib/typescript/src/MapProvider.web.d.ts.map +1 -1
  115. package/lib/typescript/src/MapView.d.ts +1 -1
  116. package/lib/typescript/src/MapView.d.ts.map +1 -1
  117. package/lib/typescript/src/MapView.types.d.ts +60 -1
  118. package/lib/typescript/src/MapView.types.d.ts.map +1 -1
  119. package/lib/typescript/src/MapView.web.d.ts +1 -1
  120. package/lib/typescript/src/MapView.web.d.ts.map +1 -1
  121. package/lib/typescript/src/components/Circle.d.ts +10 -0
  122. package/lib/typescript/src/components/Circle.d.ts.map +1 -0
  123. package/lib/typescript/src/components/Circle.types.d.ts +33 -0
  124. package/lib/typescript/src/components/Circle.types.d.ts.map +1 -0
  125. package/lib/typescript/src/components/Circle.web.d.ts +3 -0
  126. package/lib/typescript/src/components/Circle.web.d.ts.map +1 -0
  127. package/lib/typescript/src/components/GeoJson.d.ts +2 -1
  128. package/lib/typescript/src/components/GeoJson.d.ts.map +1 -1
  129. package/lib/typescript/src/components/GroundOverlay.d.ts +10 -0
  130. package/lib/typescript/src/components/GroundOverlay.d.ts.map +1 -0
  131. package/lib/typescript/src/components/GroundOverlay.types.d.ts +35 -0
  132. package/lib/typescript/src/components/GroundOverlay.types.d.ts.map +1 -0
  133. package/lib/typescript/src/components/GroundOverlay.web.d.ts +3 -0
  134. package/lib/typescript/src/components/GroundOverlay.web.d.ts.map +1 -0
  135. package/lib/typescript/src/components/Marker.d.ts +6 -3
  136. package/lib/typescript/src/components/Marker.d.ts.map +1 -1
  137. package/lib/typescript/src/components/Marker.types.d.ts +18 -6
  138. package/lib/typescript/src/components/Marker.types.d.ts.map +1 -1
  139. package/lib/typescript/src/components/Marker.web.d.ts +3 -2
  140. package/lib/typescript/src/components/Marker.web.d.ts.map +1 -1
  141. package/lib/typescript/src/components/Polygon.web.d.ts +1 -1
  142. package/lib/typescript/src/components/Polygon.web.d.ts.map +1 -1
  143. package/lib/typescript/src/components/Polyline.web.d.ts +1 -1
  144. package/lib/typescript/src/components/Polyline.web.d.ts.map +1 -1
  145. package/lib/typescript/src/components/TileOverlay.d.ts +10 -0
  146. package/lib/typescript/src/components/TileOverlay.d.ts.map +1 -0
  147. package/lib/typescript/src/components/TileOverlay.types.d.ts +36 -0
  148. package/lib/typescript/src/components/TileOverlay.types.d.ts.map +1 -0
  149. package/lib/typescript/src/components/TileOverlay.web.d.ts +3 -0
  150. package/lib/typescript/src/components/TileOverlay.web.d.ts.map +1 -0
  151. package/lib/typescript/src/components/index.d.ts +7 -1
  152. package/lib/typescript/src/components/index.d.ts.map +1 -1
  153. package/lib/typescript/src/components/index.web.d.ts +6 -0
  154. package/lib/typescript/src/components/index.web.d.ts.map +1 -1
  155. package/lib/typescript/src/fabric/LuggCalloutViewNativeComponent.d.ts +1 -1
  156. package/lib/typescript/src/fabric/LuggCircleViewNativeComponent.d.ts +18 -0
  157. package/lib/typescript/src/fabric/LuggCircleViewNativeComponent.d.ts.map +1 -0
  158. package/lib/typescript/src/fabric/LuggGroundOverlayViewNativeComponent.d.ts +21 -0
  159. package/lib/typescript/src/fabric/LuggGroundOverlayViewNativeComponent.d.ts.map +1 -0
  160. package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts +13 -5
  161. package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts.map +1 -1
  162. package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts +8 -1
  163. package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts.map +1 -1
  164. package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts +21 -0
  165. package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts.map +1 -0
  166. package/lib/typescript/src/index.d.ts +9 -3
  167. package/lib/typescript/src/index.d.ts.map +1 -1
  168. package/lib/typescript/src/index.web.d.ts +7 -1
  169. package/lib/typescript/src/index.web.d.ts.map +1 -1
  170. package/lib/typescript/src/types.d.ts +0 -4
  171. package/lib/typescript/src/types.d.ts.map +1 -1
  172. package/package.json +17 -11
  173. package/src/MapProvider.web.tsx +5 -3
  174. package/src/MapView.tsx +19 -1
  175. package/src/MapView.types.ts +142 -1
  176. package/src/MapView.web.tsx +379 -340
  177. package/src/components/Circle.tsx +52 -0
  178. package/src/components/Circle.types.ts +33 -0
  179. package/src/components/Circle.web.tsx +95 -0
  180. package/src/components/GeoJson.tsx +3 -3
  181. package/src/components/GroundOverlay.tsx +47 -0
  182. package/src/components/GroundOverlay.types.ts +36 -0
  183. package/src/components/GroundOverlay.web.tsx +81 -0
  184. package/src/components/Marker.tsx +32 -6
  185. package/src/components/Marker.types.ts +19 -6
  186. package/src/components/Marker.web.tsx +196 -150
  187. package/src/components/Polygon.web.tsx +93 -89
  188. package/src/components/Polyline.web.tsx +235 -235
  189. package/src/components/TileOverlay.tsx +44 -0
  190. package/src/components/TileOverlay.types.ts +37 -0
  191. package/src/components/TileOverlay.web.tsx +97 -0
  192. package/src/components/index.ts +10 -0
  193. package/src/components/index.web.ts +9 -0
  194. package/src/fabric/LuggCalloutViewNativeComponent.ts +1 -1
  195. package/src/fabric/LuggCircleViewNativeComponent.ts +25 -0
  196. package/src/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
  197. package/src/fabric/LuggMapViewNativeComponent.ts +16 -5
  198. package/src/fabric/LuggMarkerViewNativeComponent.ts +14 -2
  199. package/src/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
  200. package/src/index.ts +12 -1
  201. package/src/index.web.ts +15 -0
  202. package/src/types.ts +0 -5
  203. package/plugin/build/withMapsAndroid.d.ts +0 -5
  204. package/plugin/build/withMapsAndroid.js +0 -15
  205. package/plugin/build/withMapsIOS.d.ts +0 -5
  206. package/plugin/build/withMapsIOS.js +0 -27
@@ -11,8 +11,10 @@ struct CameraIdleEvent {
11
11
  double zoom;
12
12
  bool gesture;
13
13
 
14
- template <typename Emitter>
15
- void emit(const facebook::react::SharedEventEmitter &eventEmitter) const {
14
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
15
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
16
+ template <typename Emitter, typename EventEmitterPtr>
17
+ void emit(const EventEmitterPtr &eventEmitter) const {
16
18
  if (!eventEmitter)
17
19
  return;
18
20
  auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
@@ -11,8 +11,10 @@ struct CameraMoveEvent {
11
11
  double zoom;
12
12
  bool gesture;
13
13
 
14
- template <typename Emitter>
15
- void emit(const facebook::react::SharedEventEmitter &eventEmitter) const {
14
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
15
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
16
+ template <typename Emitter, typename EventEmitterPtr>
17
+ void emit(const EventEmitterPtr &eventEmitter) const {
16
18
  if (!eventEmitter)
17
19
  return;
18
20
  auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
@@ -0,0 +1,22 @@
1
+ #pragma once
2
+
3
+ #import <react/renderer/components/RNMapsSpec/EventEmitters.h>
4
+
5
+ namespace luggmaps {
6
+ namespace events {
7
+
8
+ struct CirclePressEvent {
9
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
10
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
11
+ template <typename Emitter, typename EventEmitterPtr>
12
+ static void emit(const EventEmitterPtr &eventEmitter) {
13
+ if (!eventEmitter)
14
+ return;
15
+ auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
16
+ typename Emitter::OnCirclePress event;
17
+ emitter->onCirclePress(event);
18
+ }
19
+ };
20
+
21
+ } // namespace events
22
+ } // namespace luggmaps
@@ -0,0 +1,22 @@
1
+ #pragma once
2
+
3
+ #import <react/renderer/components/RNMapsSpec/EventEmitters.h>
4
+
5
+ namespace luggmaps {
6
+ namespace events {
7
+
8
+ struct GroundOverlayPressEvent {
9
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
10
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
11
+ template <typename Emitter, typename EventEmitterPtr>
12
+ static void emit(const EventEmitterPtr &eventEmitter) {
13
+ if (!eventEmitter)
14
+ return;
15
+ auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
16
+ typename Emitter::OnGroundOverlayPress event;
17
+ emitter->onGroundOverlayPress(event);
18
+ }
19
+ };
20
+
21
+ } // namespace events
22
+ } // namespace luggmaps
@@ -11,8 +11,10 @@ struct LongPressEvent {
11
11
  double x;
12
12
  double y;
13
13
 
14
- template <typename Emitter>
15
- void emit(const facebook::react::SharedEventEmitter &eventEmitter) const {
14
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
15
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
16
+ template <typename Emitter, typename EventEmitterPtr>
17
+ void emit(const EventEmitterPtr &eventEmitter) const {
16
18
  if (!eventEmitter)
17
19
  return;
18
20
  auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
@@ -11,8 +11,10 @@ struct MarkerDragStartEvent {
11
11
  double x;
12
12
  double y;
13
13
 
14
- template <typename Emitter>
15
- void emit(const facebook::react::SharedEventEmitter &eventEmitter) const {
14
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
15
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
16
+ template <typename Emitter, typename EventEmitterPtr>
17
+ void emit(const EventEmitterPtr &eventEmitter) const {
16
18
  if (!eventEmitter)
17
19
  return;
18
20
  auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
@@ -31,8 +33,10 @@ struct MarkerDragChangeEvent {
31
33
  double x;
32
34
  double y;
33
35
 
34
- template <typename Emitter>
35
- void emit(const facebook::react::SharedEventEmitter &eventEmitter) const {
36
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
37
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
38
+ template <typename Emitter, typename EventEmitterPtr>
39
+ void emit(const EventEmitterPtr &eventEmitter) const {
36
40
  if (!eventEmitter)
37
41
  return;
38
42
  auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
@@ -51,8 +55,10 @@ struct MarkerDragEndEvent {
51
55
  double x;
52
56
  double y;
53
57
 
54
- template <typename Emitter>
55
- void emit(const facebook::react::SharedEventEmitter &eventEmitter) const {
58
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
59
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
60
+ template <typename Emitter, typename EventEmitterPtr>
61
+ void emit(const EventEmitterPtr &eventEmitter) const {
56
62
  if (!eventEmitter)
57
63
  return;
58
64
  auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
@@ -11,8 +11,10 @@ struct MarkerPressEvent {
11
11
  double x;
12
12
  double y;
13
13
 
14
- template <typename Emitter>
15
- void emit(const facebook::react::SharedEventEmitter &eventEmitter) const {
14
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
15
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
16
+ template <typename Emitter, typename EventEmitterPtr>
17
+ void emit(const EventEmitterPtr &eventEmitter) const {
16
18
  if (!eventEmitter)
17
19
  return;
18
20
  auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
@@ -6,8 +6,10 @@ namespace luggmaps {
6
6
  namespace events {
7
7
 
8
8
  struct PolygonPressEvent {
9
- template <typename Emitter>
10
- static void emit(const facebook::react::SharedEventEmitter &eventEmitter) {
9
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
10
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
11
+ template <typename Emitter, typename EventEmitterPtr>
12
+ static void emit(const EventEmitterPtr &eventEmitter) {
11
13
  if (!eventEmitter)
12
14
  return;
13
15
  auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
@@ -11,8 +11,10 @@ struct PressEvent {
11
11
  double x;
12
12
  double y;
13
13
 
14
- template <typename Emitter>
15
- void emit(const facebook::react::SharedEventEmitter &eventEmitter) const {
14
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
15
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
16
+ template <typename Emitter, typename EventEmitterPtr>
17
+ void emit(const EventEmitterPtr &eventEmitter) const {
16
18
  if (!eventEmitter)
17
19
  return;
18
20
  auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
@@ -6,8 +6,10 @@ namespace luggmaps {
6
6
  namespace events {
7
7
 
8
8
  struct ReadyEvent {
9
- template <typename Emitter>
10
- static void emit(const facebook::react::SharedEventEmitter &eventEmitter) {
9
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
10
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
11
+ template <typename Emitter, typename EventEmitterPtr>
12
+ static void emit(const EventEmitterPtr &eventEmitter) {
11
13
  if (!eventEmitter)
12
14
  return;
13
15
  auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
@@ -0,0 +1,22 @@
1
+ #pragma once
2
+
3
+ #import <react/renderer/components/RNMapsSpec/EventEmitters.h>
4
+
5
+ namespace luggmaps {
6
+ namespace events {
7
+
8
+ struct TileOverlayPressEvent {
9
+ // Holder type is templated to bridge RN versions: SharedEventEmitter went
10
+ // from shared_ptr<const EventEmitter> to shared_ptr<EventEmitter> in 0.85.
11
+ template <typename Emitter, typename EventEmitterPtr>
12
+ static void emit(const EventEmitterPtr &eventEmitter) {
13
+ if (!eventEmitter)
14
+ return;
15
+ auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
16
+ typename Emitter::OnTileOverlayPress event;
17
+ emitter->onTileOverlayPress(event);
18
+ }
19
+ };
20
+
21
+ } // namespace events
22
+ } // namespace luggmaps
@@ -2,12 +2,32 @@
2
2
 
3
3
  NS_ASSUME_NONNULL_BEGIN
4
4
 
5
+ #ifdef __cplusplus
6
+ extern "C" {
7
+ #endif
8
+
9
+ /// Coordinate span for a Google-style zoom level, shared by the live map
10
+ /// (MKMapView region) and the static snapshotter (no map view)
11
+ MKCoordinateSpan
12
+ LuggCoordinateSpanForZoomLevel(double zoomLevel,
13
+ CLLocationCoordinate2D centerCoordinate);
14
+
15
+ #ifdef __cplusplus
16
+ }
17
+ #endif
18
+
5
19
  @interface MKMapView (Zoom)
6
20
 
7
21
  - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate
8
22
  zoomLevel:(double)zoomLevel
9
23
  animated:(BOOL)animated;
10
24
 
25
+ /// Returns a camera for the given center and zoom level, preserving the current
26
+ /// heading and pitch
27
+ - (MKMapCamera *)cameraForCenterCoordinate:
28
+ (CLLocationCoordinate2D)centerCoordinate
29
+ zoomLevel:(double)zoomLevel;
30
+
11
31
  - (MKCoordinateRegion)regionForCenterCoordinate:
12
32
  (CLLocationCoordinate2D)centerCoordinate
13
33
  zoomLevel:(double)zoomLevel;
@@ -1,30 +1,31 @@
1
1
  #import "MKMapView+Zoom.h"
2
2
 
3
- @implementation MKMapView (Zoom)
3
+ // Google Maps: zoom level defines how many 256px tiles fit the world
4
+ // At zoom 0, 1 tile = 360 degrees
5
+ // Each zoom level doubles the number of tiles (halves the degrees per tile)
6
+ // Offset of ~0.5 adjusts for difference between Google Maps and MKMapView
7
+ // rendering
8
+ MKCoordinateSpan LuggCoordinateSpanForZoomLevel(
9
+ double zoomLevel, CLLocationCoordinate2D centerCoordinate) {
10
+ double adjustedZoom = zoomLevel - 0.5;
11
+ double latitudeDelta = 360.0 / pow(2, adjustedZoom);
4
12
 
5
- - (MKCoordinateSpan)coordinateSpanForZoomLevel:(double)zoomLevel centerCoordinate:(CLLocationCoordinate2D)centerCoordinate
6
- {
7
- // Google Maps: zoom level defines how many 256px tiles fit the world
8
- // At zoom 0, 1 tile = 360 degrees
9
- // Each zoom level doubles the number of tiles (halves the degrees per tile)
10
- // Offset of ~0.5 adjusts for difference between Google Maps and MKMapView rendering
11
- double adjustedZoom = zoomLevel - 0.5;
12
- double latitudeDelta = 360.0 / pow(2, adjustedZoom);
13
-
14
- // Adjust longitude delta for latitude (Mercator projection)
15
- double longitudeDelta = latitudeDelta / cos(centerCoordinate.latitude * M_PI / 180.0);
16
-
17
- return MKCoordinateSpanMake(latitudeDelta, longitudeDelta);
13
+ // Adjust longitude delta for latitude (Mercator projection)
14
+ double longitudeDelta =
15
+ latitudeDelta / cos(centerCoordinate.latitude * M_PI / 180.0);
16
+
17
+ return MKCoordinateSpanMake(latitudeDelta, longitudeDelta);
18
18
  }
19
19
 
20
+ @implementation MKMapView (Zoom)
21
+
20
22
  #pragma mark - Public Methods
21
23
 
22
24
  // Constant for altitude/zoom conversion (meters at zoom level 0)
23
25
  static const double kAltitudeAtZoomZero = 220000000.0;
24
26
 
25
- - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate
26
- zoomLevel:(double)zoomLevel
27
- animated:(BOOL)animated
27
+ - (MKMapCamera *)cameraForCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate
28
+ zoomLevel:(double)zoomLevel
28
29
  {
29
30
  // Use camera API directly to avoid region/margin interaction
30
31
  CLLocationDistance altitude = kAltitudeAtZoomZero / pow(2, zoomLevel);
@@ -33,6 +34,15 @@ static const double kAltitudeAtZoomZero = 220000000.0;
33
34
  eyeAltitude:altitude];
34
35
  camera.pitch = self.camera.pitch;
35
36
  camera.heading = self.camera.heading;
37
+ return camera;
38
+ }
39
+
40
+ - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate
41
+ zoomLevel:(double)zoomLevel
42
+ animated:(BOOL)animated
43
+ {
44
+ MKMapCamera *camera = [self cameraForCenterCoordinate:centerCoordinate
45
+ zoomLevel:zoomLevel];
36
46
  [self setCamera:camera animated:animated];
37
47
  }
38
48
 
@@ -40,7 +50,7 @@ static const double kAltitudeAtZoomZero = 220000000.0;
40
50
  zoomLevel:(double)zoomLevel
41
51
  {
42
52
  zoomLevel = MIN(zoomLevel, 28);
43
- MKCoordinateSpan span = [self coordinateSpanForZoomLevel:zoomLevel centerCoordinate:centerCoordinate];
53
+ MKCoordinateSpan span = LuggCoordinateSpanForZoomLevel(zoomLevel, centerCoordinate);
44
54
  return MKCoordinateRegionMake(centerCoordinate, span);
45
55
  }
46
56
 
@@ -0,0 +1,16 @@
1
+ #import <UIKit/UIKit.h>
2
+
3
+ NS_ASSUME_NONNULL_BEGIN
4
+
5
+ @interface UIView (LuggSnapshot)
6
+
7
+ /**
8
+ * Renders the currently presented content into an image view matching
9
+ * this view's frame and autoresizing behavior. Returns nil if the view
10
+ * has no size or the snapshot could not be rendered.
11
+ */
12
+ - (nullable UIImageView *)lugg_snapshotImageView;
13
+
14
+ @end
15
+
16
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,27 @@
1
+ #import "UIView+Snapshot.h"
2
+
3
+ @implementation UIView (LuggSnapshot)
4
+
5
+ - (nullable UIImageView *)lugg_snapshotImageView {
6
+ CGRect bounds = self.bounds;
7
+ if (bounds.size.width <= 0 || bounds.size.height <= 0)
8
+ return nil;
9
+
10
+ UIGraphicsImageRendererFormat *format =
11
+ [UIGraphicsImageRendererFormat preferredFormat];
12
+ format.opaque = YES;
13
+ UIGraphicsImageRenderer *renderer =
14
+ [[UIGraphicsImageRenderer alloc] initWithBounds:bounds format:format];
15
+ UIImage *image = [renderer
16
+ imageWithActions:^(UIGraphicsImageRendererContext *context) {
17
+ [self drawViewHierarchyInRect:bounds afterScreenUpdates:NO];
18
+ }];
19
+
20
+ UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.frame];
21
+ imageView.autoresizingMask =
22
+ UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
23
+ imageView.image = image;
24
+ return imageView;
25
+ }
26
+
27
+ @end
@@ -3,9 +3,12 @@
3
3
  import { createContext, useContext } from 'react';
4
4
  import { APIProvider } from '@vis.gl/react-google-maps';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
+ const defaultDraggingRef = {
7
+ current: false
8
+ };
6
9
  export const MapContext = /*#__PURE__*/createContext({
7
10
  map: null,
8
- isDragging: false,
11
+ isDraggingRef: defaultDraggingRef,
9
12
  moveCamera: () => {},
10
13
  onCalloutClose: () => () => {},
11
14
  closeCallouts: () => {}
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useContext","APIProvider","jsx","_jsx","MapContext","map","isDragging","moveCamera","onCalloutClose","closeCallouts","useMapContext","MapProvider","apiKey","children"],"sourceRoot":"../../src","sources":["MapProvider.web.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AACjD,SAASC,WAAW,QAAQ,2BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAKxD,OAAO,MAAMC,UAAU,gBAAGL,aAAa,CAMpC;EACDM,GAAG,EAAE,IAAI;EACTC,UAAU,EAAE,KAAK;EACjBC,UAAU,EAAEA,CAAA,KAAM,CAAC,CAAC;EACpBC,cAAc,EAAEA,CAAA,KAAM,MAAM,CAAC,CAAC;EAC9BC,aAAa,EAAEA,CAAA,KAAM,CAAC;AACxB,CAAC,CAAC;AAEF,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAMV,UAAU,CAACI,UAAU,CAAC;AAEzD,OAAO,MAAMO,WAAW,GAAGA,CAAC;EAAEC,MAAM,GAAG,EAAE;EAAEC;AAA2B,CAAC,kBACrEV,IAAA,CAACF,WAAW;EAACW,MAAM,EAAEA,MAAO;EAAAC,QAAA,EAAEA;AAAQ,CAAc,CACrD","ignoreList":[]}
1
+ {"version":3,"names":["createContext","useContext","APIProvider","jsx","_jsx","defaultDraggingRef","current","MapContext","map","isDraggingRef","moveCamera","onCalloutClose","closeCallouts","useMapContext","MapProvider","apiKey","children"],"sourceRoot":"../../src","sources":["MapProvider.web.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAA+B,OAAO;AACxE,SAASC,WAAW,QAAQ,2BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAKxD,MAAMC,kBAAkB,GAAG;EAAEC,OAAO,EAAE;AAAM,CAAC;AAE7C,OAAO,MAAMC,UAAU,gBAAGP,aAAa,CAMpC;EACDQ,GAAG,EAAE,IAAI;EACTC,aAAa,EAAEJ,kBAAkB;EACjCK,UAAU,EAAEA,CAAA,KAAM,CAAC,CAAC;EACpBC,cAAc,EAAEA,CAAA,KAAM,MAAM,CAAC,CAAC;EAC9BC,aAAa,EAAEA,CAAA,KAAM,CAAC;AACxB,CAAC,CAAC;AAEF,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAMZ,UAAU,CAACM,UAAU,CAAC;AAEzD,OAAO,MAAMO,WAAW,GAAGA,CAAC;EAAEC,MAAM,GAAG,EAAE;EAAEC;AAA2B,CAAC,kBACrEZ,IAAA,CAACF,WAAW;EAACa,MAAM,EAAEA,MAAO;EAAAC,QAAA,EAAEA;AAAQ,CAAc,CACrD","ignoreList":[]}
@@ -5,14 +5,17 @@ import { Platform, StyleSheet } from 'react-native';
5
5
  import LuggMapViewNativeComponent, { Commands } from './fabric/LuggMapViewNativeComponent';
6
6
  import LuggMapWrapperViewNativeComponent from './fabric/LuggMapWrapperViewNativeComponent';
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
- export class MapView extends React.Component {
8
+ export class MapView extends React.PureComponent {
9
9
  static defaultProps = {
10
10
  provider: Platform.OS === 'ios' ? 'apple' : 'google',
11
+ mapType: 'standard',
11
12
  initialZoom: 10,
12
13
  zoomEnabled: true,
13
14
  scrollEnabled: true,
14
15
  rotateEnabled: true,
15
16
  pitchEnabled: true,
17
+ compassEnabled: true,
18
+ poiEnabled: true,
16
19
  theme: 'system'
17
20
  };
18
21
  nativeRef = /*#__PURE__*/React.createRef();
@@ -66,6 +69,7 @@ export class MapView extends React.Component {
66
69
  render() {
67
70
  const {
68
71
  provider,
72
+ mapType,
69
73
  mapId,
70
74
  initialCoordinate,
71
75
  initialZoom,
@@ -75,10 +79,16 @@ export class MapView extends React.Component {
75
79
  scrollEnabled,
76
80
  rotateEnabled,
77
81
  pitchEnabled,
82
+ compassEnabled,
83
+ staticMode,
84
+ staticKey,
78
85
  edgeInsets,
79
86
  userLocationEnabled,
80
87
  userLocationButtonEnabled,
88
+ poiEnabled,
89
+ poiFilter,
81
90
  theme,
91
+ insetAdjustment,
82
92
  onPress,
83
93
  onLongPress,
84
94
  onCameraMove,
@@ -91,6 +101,7 @@ export class MapView extends React.Component {
91
101
  ref: this.nativeRef,
92
102
  ...rest,
93
103
  provider: provider,
104
+ mapType: mapType,
94
105
  mapId: mapId,
95
106
  initialCoordinate: initialCoordinate,
96
107
  initialZoom: initialZoom,
@@ -100,10 +111,17 @@ export class MapView extends React.Component {
100
111
  scrollEnabled: scrollEnabled,
101
112
  rotateEnabled: rotateEnabled,
102
113
  pitchEnabled: pitchEnabled,
114
+ compassEnabled: compassEnabled,
115
+ staticMode: staticMode,
116
+ staticKey: staticKey,
103
117
  edgeInsets: edgeInsets,
104
118
  userLocationEnabled: userLocationEnabled,
105
119
  userLocationButtonEnabled: userLocationButtonEnabled,
120
+ poiEnabled: poiEnabled,
121
+ poiFilterMode: poiFilter?.mode,
122
+ poiFilterCategories: poiFilter?.categories,
106
123
  theme: theme,
124
+ insetAdjustment: insetAdjustment,
107
125
  onMapPress: onPress,
108
126
  onMapLongPress: onLongPress,
109
127
  onCameraMove: onCameraMove,
@@ -1 +1 @@
1
- {"version":3,"names":["React","Platform","StyleSheet","LuggMapViewNativeComponent","Commands","LuggMapWrapperViewNativeComponent","jsx","_jsx","jsxs","_jsxs","MapView","Component","defaultProps","provider","OS","initialZoom","zoomEnabled","scrollEnabled","rotateEnabled","pitchEnabled","theme","nativeRef","createRef","moveCamera","coordinate","options","ref","current","zoom","duration","latitude","longitude","fitCoordinates","coordinates","first","padding","top","left","bottom","right","length","props","setEdgeInsets","edgeInsets","render","mapId","initialCoordinate","minZoom","maxZoom","userLocationEnabled","userLocationButtonEnabled","onPress","onLongPress","onCameraMove","onCameraIdle","onReady","children","rest","onMapPress","onMapLongPress","style","absoluteFill"],"sourceRoot":"../../src","sources":["MapView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AACnD,OAAOC,0BAA0B,IAC/BC,QAAQ,QACH,qCAAqC;AAC5C,OAAOC,iCAAiC,MAAM,4CAA4C;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAU3F,OAAO,MAAMC,OAAO,SACVV,KAAK,CAACW,SAAS,CAEzB;EACE,OAAOC,YAAY,GAA0B;IAC3CC,QAAQ,EAAEZ,QAAQ,CAACa,EAAE,KAAK,KAAK,GAAG,OAAO,GAAG,QAAQ;IACpDC,WAAW,EAAE,EAAE;IACfC,WAAW,EAAE,IAAI;IACjBC,aAAa,EAAE,IAAI;IACnBC,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,IAAI;IAClBC,KAAK,EAAE;EACT,CAAC;EAEOC,SAAS,gBAAGrB,KAAK,CAACsB,SAAS,CAAM,CAAC;EAE1CC,UAAUA,CAACC,UAAsB,EAAEC,OAA2B,EAAE;IAC9D,MAAMC,GAAG,GAAG,IAAI,CAACL,SAAS,CAACM,OAAO;IAClC,IAAI,CAACD,GAAG,EAAE;IAEV,MAAM;MAAEE,IAAI,GAAG,CAAC;MAA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,IAAA,CAACF,iCAAiC;QAACuD,KAAK,EAAE1D,UAAU,CAAC2D;MAAa,CAAE,CAAC,EACpEL,QAAQ;IAAA,CACiB,CAAC;EAEjC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","Platform","StyleSheet","LuggMapViewNativeComponent","Commands","LuggMapWrapperViewNativeComponent","jsx","_jsx","jsxs","_jsxs","MapView","PureComponent","defaultProps","provider","OS","mapType","initialZoom","zoomEnabled","scrollEnabled","rotateEnabled","pitchEnabled","compassEnabled","poiEnabled","theme","nativeRef","createRef","moveCamera","coordinate","options","ref","current","zoom","duration","latitude","longitude","fitCoordinates","coordinates","first","padding","top","left","bottom","right","length","props","setEdgeInsets","edgeInsets","render","mapId","initialCoordinate","minZoom","maxZoom","staticMode","staticKey","userLocationEnabled","userLocationButtonEnabled","poiFilter","insetAdjustment","onPress","onLongPress","onCameraMove","onCameraIdle","onReady","children","rest","poiFilterMode","mode","poiFilterCategories","categories","onMapPress","onMapLongPress","style","absoluteFill"],"sourceRoot":"../../src","sources":["MapView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AACnD,OAAOC,0BAA0B,IAC/BC,QAAQ,QACH,qCAAqC;AAC5C,OAAOC,iCAAiC,MAAM,4CAA4C;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAU3F,OAAO,MAAMC,OAAO,SACVV,KAAK,CAACW,aAAa,CAE7B;EACE,OAAOC,YAAY,GAA0B;IAC3CC,QAAQ,EAAEZ,QAAQ,CAACa,EAAE,KAAK,KAAK,GAAG,OAAO,GAAG,QAAQ;IACpDC,OAAO,EAAE,UAAU;IACnBC,WAAW,EAAE,EAAE;IACfC,WAAW,EAAE,IAAI;IACjBC,aAAa,EAAE,IAAI;IACnBC,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,IAAI;IAClBC,cAAc,EAAE,IAAI;IACpBC,U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MACjBlC,WAAW,EAAEA,WAAY;MACzBC,aAAa,EAAEA,aAAc;MAC7BC,aAAa,EAAEA,aAAc;MAC7BC,YAAY,EAAEA,YAAa;MAC3BC,cAAc,EAAEA,cAAe;MAC/B+B,UAAU,EAAEA,UAAW;MACvBC,SAAS,EAAEA,SAAU;MACrBP,UAAU,EAAEA,UAAW;MACvBQ,mBAAmB,EAAEA,mBAAoB;MACzCC,yBAAyB,EAAEA,yBAA0B;MACrDjC,UAAU,EAAEA,UAAW;MACvB2C,aAAa,EAAET,SAAS,EAAEU,IAAK;MAC/BC,mBAAmB,EAAEX,SAAS,EAAEY,UAAW;MAC3C7C,KAAK,EAAEA,KAAM;MACbkC,eAAe,EAAEA,eAAgB;MACjCY,UAAU,EAAEX,OAAQ;MACpBY,cAAc,EAAEX,WAAY;MAC5BC,YAAY,EAAEA,YAAa;MAC3BC,YAAY,EAAEA,YAAa;MAC3BC,OAAO,EAAEA,OAAQ;MAAAC,QAAA,gBAEjBxD,IAAA,CAACF,iCAAiC;QAACkE,KAAK,EAAErE,UAAU,CAACsE;MAAa,CAAE,CAAC,EACpET,QAAQ;IAAA,CACiB,CAAC;EAEjC;AACF","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { forwardRef, useCallback, useEffect, useId, useImperativeHandle, useRef, useState } from 'react';
3
+ import { forwardRef, memo, useCallback, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from 'react';
4
4
  import { View } from 'react-native';
5
5
  import { ColorScheme, Map, useMap } from '@vis.gl/react-google-maps';
6
6
  import { Marker } from "./components/Marker.web.js";
@@ -67,8 +67,9 @@ const UserLocationMarker = ({
67
67
  })
68
68
  });
69
69
  };
70
- export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
70
+ export const MapView = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function MapView(props, ref) {
71
71
  const {
72
+ mapType = 'standard',
72
73
  mapId = 'DEMO_MAP_ID',
73
74
  initialCoordinate,
74
75
  initialZoom = 10,
@@ -77,6 +78,8 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
77
78
  zoomEnabled = true,
78
79
  scrollEnabled = true,
79
80
  pitchEnabled = true,
81
+ compassEnabled = true,
82
+ staticMode = false,
80
83
  edgeInsets,
81
84
  userLocationEnabled,
82
85
  theme = 'system',
@@ -92,7 +95,7 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
92
95
  const map = useMap(id);
93
96
  const containerRef = useRef(null);
94
97
  const readyFired = useRef(false);
95
- const [isDragging, setIsDragging] = useState(false);
98
+ const isDraggingRef = useRef(false);
96
99
  const wasGesture = useRef(false);
97
100
  const prevEdgeInsets = useRef(edgeInsets);
98
101
  const offsetCenter = useCallback((coord, zoom, insets, reverse = false) => {
@@ -283,22 +286,22 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
283
286
  }
284
287
  }, []);
285
288
  useEffect(() => {
286
- if (!map || !onLongPress) return;
289
+ if (!map || !onLongPress || staticMode) return;
287
290
  const listeners = [map.addListener('mousedown', handleMouseDown), map.addListener('mouseup', handleMouseUp)];
288
291
  return () => {
289
292
  listeners.forEach(l => google.maps.event.removeListener(l));
290
293
  handleMouseUp();
291
294
  };
292
- }, [map, onLongPress, handleMouseDown, handleMouseUp]);
293
- const handleDragStart = () => {
295
+ }, [map, onLongPress, staticMode, handleMouseDown, handleMouseUp]);
296
+ const handleDragStart = useCallback(() => {
294
297
  handleMouseUp();
295
- setIsDragging(true);
298
+ isDraggingRef.current = true;
296
299
  wasGesture.current = true;
297
- };
298
- const handleDragEnd = () => {
299
- setIsDragging(false);
300
- };
301
- const handleCameraChanged = event => {
300
+ }, [handleMouseUp]);
301
+ const handleDragEnd = useCallback(() => {
302
+ isDraggingRef.current = false;
303
+ }, []);
304
+ const handleCameraChanged = useCallback(event => {
302
305
  const logicalCenter = offsetCenter({
303
306
  latitude: event.detail.center.lat,
304
307
  longitude: event.detail.center.lng
@@ -309,11 +312,11 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
309
312
  longitude: logicalCenter.lng
310
313
  },
311
314
  zoom: event.detail.zoom,
312
- gesture: isDragging
315
+ gesture: isDraggingRef.current
313
316
  };
314
317
  onCameraMove?.(createSyntheticEvent(payload));
315
- };
316
- const handleIdle = event => {
318
+ }, [offsetCenter, onCameraMove]);
319
+ const handleIdle = useCallback(event => {
317
320
  const center = event.map.getCenter();
318
321
  const zoom = event.map.getZoom() ?? 0;
319
322
  const logicalCenter = offsetCenter({
@@ -330,21 +333,22 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
330
333
  };
331
334
  onCameraIdle?.(createSyntheticEvent(payload));
332
335
  wasGesture.current = false;
333
- };
334
- const gestureHandling = scrollEnabled === false && zoomEnabled === false ? 'none' : scrollEnabled === false ? 'cooperative' : 'auto';
336
+ }, [offsetCenter, onCameraIdle]);
337
+ const mapTypeId = mapType === 'satellite' ? 'satellite' : mapType === 'terrain' ? 'terrain' : mapType === 'hybrid' ? 'hybrid' : 'roadmap';
338
+ const gestureHandling = staticMode ? 'none' : scrollEnabled === false && zoomEnabled === false ? 'none' : scrollEnabled === false ? 'cooperative' : 'auto';
335
339
  const colorScheme = theme === 'dark' ? ColorScheme.DARK : theme === 'light' ? ColorScheme.LIGHT : ColorScheme.FOLLOW_SYSTEM;
336
340
  const defaultCenter = initialCoordinate ? {
337
341
  lat: initialCoordinate.latitude,
338
342
  lng: initialCoordinate.longitude
339
343
  } : undefined;
340
344
  return /*#__PURE__*/_jsx(MapContext.Provider, {
341
- value: {
345
+ value: useMemo(() => ({
342
346
  map,
343
- isDragging,
347
+ isDraggingRef,
344
348
  moveCamera: panToCoordinate,
345
349
  onCalloutClose,
346
350
  closeCallouts
347
- },
351
+ }), [map, panToCoordinate, onCalloutClose, closeCallouts]),
348
352
  children: /*#__PURE__*/_jsx(View, {
349
353
  ref: containerRef,
350
354
  style: style,
@@ -355,12 +359,16 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
355
359
  defaultZoom: initialZoom,
356
360
  minZoom: minZoom,
357
361
  maxZoom: maxZoom,
362
+ mapTypeId: mapTypeId,
358
363
  gestureHandling: gestureHandling,
359
364
  colorScheme: colorScheme,
360
365
  disableDefaultUI: true,
366
+ rotateControl: staticMode ? false : compassEnabled,
367
+ clickableIcons: !staticMode,
368
+ keyboardShortcuts: !staticMode,
361
369
  isFractionalZoomEnabled: true,
362
370
  tilt: pitchEnabled === false ? 0 : undefined,
363
- onClick: handleClick,
371
+ onClick: staticMode ? undefined : handleClick,
364
372
  onDragstart: handleDragStart,
365
373
  onDragend: handleDragEnd,
366
374
  onCameraChanged: handleCameraChanged,
@@ -371,5 +379,5 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
371
379
  })
372
380
  })
373
381
  });
374
- });
382
+ }));
375
383
  //# sourceMappingURL=MapView.web.js.map