@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.
- package/README.md +3 -0
- package/android/src/main/java/com/luggmaps/LuggCalloutView.kt +9 -2
- package/android/src/main/java/com/luggmaps/LuggCalloutViewManager.kt +4 -3
- package/android/src/main/java/com/luggmaps/LuggCircleView.kt +85 -0
- package/android/src/main/java/com/luggmaps/LuggCircleViewManager.kt +79 -0
- package/android/src/main/java/com/luggmaps/LuggGroundOverlayView.kt +81 -0
- package/android/src/main/java/com/luggmaps/LuggGroundOverlayViewManager.kt +82 -0
- package/android/src/main/java/com/luggmaps/LuggMapView.kt +90 -0
- package/android/src/main/java/com/luggmaps/LuggMapViewManager.kt +45 -0
- package/android/src/main/java/com/luggmaps/LuggMapWrapperView.kt +27 -2
- package/android/src/main/java/com/luggmaps/LuggMarkerView.kt +30 -2
- package/android/src/main/java/com/luggmaps/LuggMarkerViewManager.kt +13 -0
- package/android/src/main/java/com/luggmaps/LuggPackage.kt +4 -1
- package/android/src/main/java/com/luggmaps/LuggPolylineView.kt +3 -23
- package/android/src/main/java/com/luggmaps/LuggTileOverlayView.kt +92 -0
- package/android/src/main/java/com/luggmaps/LuggTileOverlayViewManager.kt +80 -0
- package/android/src/main/java/com/luggmaps/core/GoogleMapProvider.kt +676 -36
- package/android/src/main/java/com/luggmaps/core/MapProviderDelegate.kt +15 -0
- package/android/src/main/java/com/luggmaps/core/PolylineAnimator.kt +65 -11
- package/android/src/main/java/com/luggmaps/events/CirclePressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/events/GroundOverlayPressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/events/TileOverlayPressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/extensions/ViewExtensions.kt +11 -0
- package/ios/LuggCalloutView.h +1 -1
- package/ios/LuggCalloutView.mm +21 -11
- package/ios/LuggCircleView.h +31 -0
- package/ios/LuggCircleView.mm +133 -0
- package/ios/LuggGroundOverlayView.h +30 -0
- package/ios/LuggGroundOverlayView.mm +125 -0
- package/ios/LuggMapView.mm +254 -4
- package/ios/LuggMapWrapperView.h +5 -0
- package/ios/LuggMapWrapperView.mm +18 -0
- package/ios/LuggMarkerView.h +3 -0
- package/ios/LuggMarkerView.mm +25 -0
- package/ios/LuggTileOverlayView.h +31 -0
- package/ios/LuggTileOverlayView.mm +130 -0
- package/ios/core/AppleMapProvider.h +8 -0
- package/ios/core/AppleMapProvider.mm +663 -29
- package/ios/core/AppleStaticMapProvider.h +14 -0
- package/ios/core/AppleStaticMapProvider.mm +159 -0
- package/ios/core/GMSPolylineAnimator.m +46 -18
- package/ios/core/GoogleMapProvider.h +10 -0
- package/ios/core/GoogleMapProvider.mm +430 -51
- package/ios/core/GoogleStaticMapProvider.h +21 -0
- package/ios/core/GoogleStaticMapProvider.mm +213 -0
- package/ios/core/MKPolylineAnimator.m +67 -43
- package/ios/core/MapProviderDelegate.h +27 -1
- package/ios/core/StaticMapProviderBase.h +75 -0
- package/ios/core/StaticMapProviderBase.mm +845 -0
- package/ios/events/CameraIdleEvent.h +4 -2
- package/ios/events/CameraMoveEvent.h +4 -2
- package/ios/events/CirclePressEvent.h +22 -0
- package/ios/events/GroundOverlayPressEvent.h +22 -0
- package/ios/events/LongPressEvent.h +4 -2
- package/ios/events/MarkerDragEvent.h +12 -6
- package/ios/events/MarkerPressEvent.h +4 -2
- package/ios/events/PolygonPressEvent.h +4 -2
- package/ios/events/PressEvent.h +4 -2
- package/ios/events/ReadyEvent.h +4 -2
- package/ios/events/TileOverlayPressEvent.h +22 -0
- package/ios/extensions/MKMapView+Zoom.h +20 -0
- package/ios/extensions/MKMapView+Zoom.m +28 -18
- package/ios/extensions/UIView+Snapshot.h +16 -0
- package/ios/extensions/UIView+Snapshot.m +27 -0
- package/lib/module/MapProvider.web.js +4 -1
- package/lib/module/MapProvider.web.js.map +1 -1
- package/lib/module/MapView.js +19 -1
- package/lib/module/MapView.js.map +1 -1
- package/lib/module/MapView.web.js +30 -22
- package/lib/module/MapView.web.js.map +1 -1
- package/lib/module/components/Circle.js +46 -0
- package/lib/module/components/Circle.js.map +1 -0
- package/lib/module/components/Circle.types.js +4 -0
- package/lib/module/components/Circle.types.js.map +1 -0
- package/lib/module/components/Circle.web.js +79 -0
- package/lib/module/components/Circle.web.js.map +1 -0
- package/lib/module/components/GeoJson.js +3 -3
- package/lib/module/components/GeoJson.js.map +1 -1
- package/lib/module/components/GroundOverlay.js +45 -0
- package/lib/module/components/GroundOverlay.js.map +1 -0
- package/lib/module/components/GroundOverlay.types.js +4 -0
- package/lib/module/components/GroundOverlay.types.js.map +1 -0
- package/lib/module/components/GroundOverlay.web.js +77 -0
- package/lib/module/components/GroundOverlay.web.js.map +1 -0
- package/lib/module/components/Marker.js +22 -4
- package/lib/module/components/Marker.js.map +1 -1
- package/lib/module/components/Marker.web.js +23 -10
- package/lib/module/components/Marker.web.js.map +1 -1
- package/lib/module/components/Polygon.web.js +3 -3
- package/lib/module/components/Polygon.web.js.map +1 -1
- package/lib/module/components/Polyline.web.js +6 -12
- package/lib/module/components/Polyline.web.js.map +1 -1
- package/lib/module/components/TileOverlay.js +44 -0
- package/lib/module/components/TileOverlay.js.map +1 -0
- package/lib/module/components/TileOverlay.types.js +4 -0
- package/lib/module/components/TileOverlay.types.js.map +1 -0
- package/lib/module/components/TileOverlay.web.js +69 -0
- package/lib/module/components/TileOverlay.web.js.map +1 -0
- package/lib/module/components/index.js +3 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/index.web.js +3 -0
- package/lib/module/components/index.web.js.map +1 -1
- package/lib/module/fabric/LuggCalloutViewNativeComponent.ts +1 -1
- package/lib/module/fabric/LuggCircleViewNativeComponent.ts +25 -0
- package/lib/module/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
- package/lib/module/fabric/LuggMapViewNativeComponent.ts +16 -5
- package/lib/module/fabric/LuggMarkerViewNativeComponent.ts +14 -2
- package/lib/module/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +3 -0
- package/lib/module/index.web.js.map +1 -1
- package/lib/typescript/src/MapProvider.web.d.ts +3 -2
- package/lib/typescript/src/MapProvider.web.d.ts.map +1 -1
- package/lib/typescript/src/MapView.d.ts +1 -1
- package/lib/typescript/src/MapView.d.ts.map +1 -1
- package/lib/typescript/src/MapView.types.d.ts +60 -1
- package/lib/typescript/src/MapView.types.d.ts.map +1 -1
- package/lib/typescript/src/MapView.web.d.ts +1 -1
- package/lib/typescript/src/MapView.web.d.ts.map +1 -1
- package/lib/typescript/src/components/Circle.d.ts +10 -0
- package/lib/typescript/src/components/Circle.d.ts.map +1 -0
- package/lib/typescript/src/components/Circle.types.d.ts +33 -0
- package/lib/typescript/src/components/Circle.types.d.ts.map +1 -0
- package/lib/typescript/src/components/Circle.web.d.ts +3 -0
- package/lib/typescript/src/components/Circle.web.d.ts.map +1 -0
- package/lib/typescript/src/components/GeoJson.d.ts +2 -1
- package/lib/typescript/src/components/GeoJson.d.ts.map +1 -1
- package/lib/typescript/src/components/GroundOverlay.d.ts +10 -0
- package/lib/typescript/src/components/GroundOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/GroundOverlay.types.d.ts +35 -0
- package/lib/typescript/src/components/GroundOverlay.types.d.ts.map +1 -0
- package/lib/typescript/src/components/GroundOverlay.web.d.ts +3 -0
- package/lib/typescript/src/components/GroundOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/components/Marker.d.ts +6 -3
- package/lib/typescript/src/components/Marker.d.ts.map +1 -1
- package/lib/typescript/src/components/Marker.types.d.ts +18 -6
- package/lib/typescript/src/components/Marker.types.d.ts.map +1 -1
- package/lib/typescript/src/components/Marker.web.d.ts +3 -2
- package/lib/typescript/src/components/Marker.web.d.ts.map +1 -1
- package/lib/typescript/src/components/Polygon.web.d.ts +1 -1
- package/lib/typescript/src/components/Polygon.web.d.ts.map +1 -1
- package/lib/typescript/src/components/Polyline.web.d.ts +1 -1
- package/lib/typescript/src/components/Polyline.web.d.ts.map +1 -1
- package/lib/typescript/src/components/TileOverlay.d.ts +10 -0
- package/lib/typescript/src/components/TileOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/TileOverlay.types.d.ts +36 -0
- package/lib/typescript/src/components/TileOverlay.types.d.ts.map +1 -0
- package/lib/typescript/src/components/TileOverlay.web.d.ts +3 -0
- package/lib/typescript/src/components/TileOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +7 -1
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/components/index.web.d.ts +6 -0
- package/lib/typescript/src/components/index.web.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggCalloutViewNativeComponent.d.ts +1 -1
- package/lib/typescript/src/fabric/LuggCircleViewNativeComponent.d.ts +18 -0
- package/lib/typescript/src/fabric/LuggCircleViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/LuggGroundOverlayViewNativeComponent.d.ts +21 -0
- package/lib/typescript/src/fabric/LuggGroundOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts +13 -5
- package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts +8 -1
- package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts +21 -0
- package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +7 -1
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +0 -4
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +17 -11
- package/src/MapProvider.web.tsx +5 -3
- package/src/MapView.tsx +19 -1
- package/src/MapView.types.ts +142 -1
- package/src/MapView.web.tsx +379 -340
- package/src/components/Circle.tsx +52 -0
- package/src/components/Circle.types.ts +33 -0
- package/src/components/Circle.web.tsx +95 -0
- package/src/components/GeoJson.tsx +3 -3
- package/src/components/GroundOverlay.tsx +47 -0
- package/src/components/GroundOverlay.types.ts +36 -0
- package/src/components/GroundOverlay.web.tsx +81 -0
- package/src/components/Marker.tsx +32 -6
- package/src/components/Marker.types.ts +19 -6
- package/src/components/Marker.web.tsx +196 -150
- package/src/components/Polygon.web.tsx +93 -89
- package/src/components/Polyline.web.tsx +235 -235
- package/src/components/TileOverlay.tsx +44 -0
- package/src/components/TileOverlay.types.ts +37 -0
- package/src/components/TileOverlay.web.tsx +97 -0
- package/src/components/index.ts +10 -0
- package/src/components/index.web.ts +9 -0
- package/src/fabric/LuggCalloutViewNativeComponent.ts +1 -1
- package/src/fabric/LuggCircleViewNativeComponent.ts +25 -0
- package/src/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
- package/src/fabric/LuggMapViewNativeComponent.ts +16 -5
- package/src/fabric/LuggMarkerViewNativeComponent.ts +14 -2
- package/src/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
- package/src/index.ts +12 -1
- package/src/index.web.ts +15 -0
- package/src/types.ts +0 -5
- package/plugin/build/withMapsAndroid.d.ts +0 -5
- package/plugin/build/withMapsAndroid.js +0 -15
- package/plugin/build/withMapsIOS.d.ts +0 -5
- package/plugin/build/withMapsIOS.js +0 -27
|
@@ -11,8 +11,10 @@ struct CameraIdleEvent {
|
|
|
11
11
|
double zoom;
|
|
12
12
|
bool gesture;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
35
|
-
|
|
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
|
-
|
|
55
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
10
|
-
|
|
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);
|
package/ios/events/PressEvent.h
CHANGED
|
@@ -11,8 +11,10 @@ struct PressEvent {
|
|
|
11
11
|
double x;
|
|
12
12
|
double y;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
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);
|
package/ios/events/ReadyEvent.h
CHANGED
|
@@ -6,8 +6,10 @@ namespace luggmaps {
|
|
|
6
6
|
namespace events {
|
|
7
7
|
|
|
8
8
|
struct ReadyEvent {
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
- (
|
|
26
|
-
|
|
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 =
|
|
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
|
-
|
|
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","
|
|
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":[]}
|
package/lib/module/MapView.js
CHANGED
|
@@ -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.
|
|
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","
|
|
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":"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","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
|
|
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
|
-
|
|
298
|
+
isDraggingRef.current = true;
|
|
296
299
|
wasGesture.current = true;
|
|
297
|
-
};
|
|
298
|
-
const handleDragEnd = () => {
|
|
299
|
-
|
|
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:
|
|
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
|
|
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
|
-
|
|
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
|