@lugg/maps 1.0.0-beta.9 → 1.1.0
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 +15 -100
- package/android/src/main/java/com/luggmaps/LuggCalloutView.kt +5 -0
- package/android/src/main/java/com/luggmaps/LuggMapView.kt +56 -2
- package/android/src/main/java/com/luggmaps/LuggMapViewManager.kt +18 -0
- package/android/src/main/java/com/luggmaps/LuggMapWrapperView.kt +36 -2
- package/android/src/main/java/com/luggmaps/LuggMarkerView.kt +7 -2
- package/android/src/main/java/com/luggmaps/LuggPolylineView.kt +2 -1
- package/android/src/main/java/com/luggmaps/core/GoogleMapProvider.kt +332 -42
- package/android/src/main/java/com/luggmaps/core/MapProviderDelegate.kt +6 -0
- package/android/src/main/java/com/luggmaps/core/PolylineAnimator.kt +61 -10
- package/ios/LuggMapView.mm +240 -10
- package/ios/LuggMapWrapperView.h +5 -0
- package/ios/LuggMapWrapperView.mm +18 -0
- package/ios/LuggMarkerView.mm +2 -0
- package/ios/core/AppleMapProvider.h +8 -0
- package/ios/core/AppleMapProvider.mm +63 -47
- package/ios/core/AppleStaticMapProvider.h +14 -0
- package/ios/core/AppleStaticMapProvider.mm +233 -0
- package/ios/core/GMSPolylineAnimator.m +40 -15
- package/ios/core/GoogleMapProvider.h +10 -0
- package/ios/core/GoogleMapProvider.mm +67 -54
- package/ios/core/GoogleStaticMapProvider.h +21 -0
- package/ios/core/GoogleStaticMapProvider.mm +217 -0
- package/ios/core/MKPolylineAnimator.m +67 -43
- package/ios/core/MapEdgeInsets.h +18 -0
- package/ios/core/MapProviderDelegate.h +11 -0
- package/ios/core/StaticMapProviderBase.h +80 -0
- package/ios/core/StaticMapProviderBase.mm +847 -0
- package/ios/events/CameraIdleEvent.h +4 -2
- package/ios/events/CameraMoveEvent.h +4 -2
- package/ios/events/CirclePressEvent.h +4 -2
- package/ios/events/GroundOverlayPressEvent.h +4 -2
- 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 +4 -2
- 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/MapView.js +12 -0
- package/lib/module/MapView.js.map +1 -1
- package/lib/module/MapView.web.js +29 -10
- package/lib/module/MapView.web.js.map +1 -1
- package/lib/module/fabric/LuggMapViewNativeComponent.ts +10 -1
- package/lib/typescript/src/MapView.d.ts +1 -0
- package/lib/typescript/src/MapView.d.ts.map +1 -1
- package/lib/typescript/src/MapView.types.d.ts +32 -0
- package/lib/typescript/src/MapView.types.d.ts.map +1 -1
- package/lib/typescript/src/MapView.web.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts +4 -0
- package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts.map +1 -1
- package/package.json +24 -14
- package/src/MapView.tsx +14 -0
- package/src/MapView.types.ts +32 -0
- package/src/MapView.web.tsx +39 -14
- package/src/fabric/LuggMapViewNativeComponent.ts +10 -1
- 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
|
@@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
13
13
|
|
|
14
14
|
@protocol MapProviderDelegate <NSObject>
|
|
15
15
|
- (void)mapProviderDidReady;
|
|
16
|
+
- (void)mapProviderDidFinishStaticSnapshot;
|
|
17
|
+
- (void)mapProviderDidCaptureStaticImage:(UIImage *)image;
|
|
16
18
|
- (void)mapProviderDidMoveCamera:(double)latitude
|
|
17
19
|
longitude:(double)longitude
|
|
18
20
|
zoom:(double)zoom
|
|
@@ -36,6 +38,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
36
38
|
@property(nonatomic, weak, nullable) id<MapProviderDelegate> delegate;
|
|
37
39
|
@property(nonatomic, readonly) BOOL isMapReady;
|
|
38
40
|
|
|
41
|
+
// Non-interactive static map. Must be set before initializeMapInView.
|
|
42
|
+
// Once fully rendered, the live map is replaced with a snapshot image.
|
|
43
|
+
@property(nonatomic, assign) BOOL staticMode;
|
|
44
|
+
|
|
39
45
|
- (void)initializeMapInView:(UIView *)wrapperView
|
|
40
46
|
initialCoordinate:(CLLocationCoordinate2D)coordinate
|
|
41
47
|
initialZoom:(double)zoom;
|
|
@@ -48,6 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
48
54
|
- (void)setScrollEnabled:(BOOL)enabled;
|
|
49
55
|
- (void)setRotateEnabled:(BOOL)enabled;
|
|
50
56
|
- (void)setPitchEnabled:(BOOL)enabled;
|
|
57
|
+
- (void)setCompassEnabled:(BOOL)enabled;
|
|
51
58
|
- (void)setUserLocationEnabled:(BOOL)enabled;
|
|
52
59
|
- (void)setMapType:(facebook::react::LuggMapViewMapType)mapType;
|
|
53
60
|
- (void)setTheme:(facebook::react::LuggMapViewTheme)theme;
|
|
@@ -82,6 +89,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
82
89
|
- (void)removeTileOverlayView:(LuggTileOverlayView *)tileOverlayView;
|
|
83
90
|
- (void)syncTileOverlayView:(LuggTileOverlayView *)tileOverlayView;
|
|
84
91
|
|
|
92
|
+
// Current camera (the initial camera until the map is ready)
|
|
93
|
+
@property(nonatomic, readonly) CLLocationCoordinate2D coordinate;
|
|
94
|
+
@property(nonatomic, readonly) double zoom;
|
|
95
|
+
|
|
85
96
|
// Lifecycle
|
|
86
97
|
- (void)pauseAnimations;
|
|
87
98
|
- (void)resumeAnimations;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#import "MapProviderDelegate.h"
|
|
2
|
+
#import <MapKit/MapKit.h>
|
|
3
|
+
|
|
4
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
5
|
+
|
|
6
|
+
/// Projects a coordinate into view points for a static map covering mapRect
|
|
7
|
+
CGPoint LuggStaticPointForCoordinate(MKMapRect mapRect, CGSize size,
|
|
8
|
+
CLLocationCoordinate2D coordinate);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Shared behavior for static (non-interactive) map providers - the iOS
|
|
12
|
+
* equivalent of Android's lite mode. The base map renders asynchronously
|
|
13
|
+
* (subclass-specific), so static maps keep loading while the user scrolls
|
|
14
|
+
* without blocking the main thread.
|
|
15
|
+
*
|
|
16
|
+
* Markers are live views positioned over the base map via a mercator
|
|
17
|
+
* projection (mirroring Android's live markers on lite maps), so async
|
|
18
|
+
* marker content (e.g. remote images) still updates when it loads.
|
|
19
|
+
* Polylines, polygons, circles and ground overlays are drawn into a
|
|
20
|
+
* single CoreGraphics overlay view. All overlays stay hidden over the
|
|
21
|
+
* placeholder and reveal together with the base map. Tile overlays are
|
|
22
|
+
* not supported.
|
|
23
|
+
*/
|
|
24
|
+
@interface StaticMapProviderBase : NSObject <MapProvider>
|
|
25
|
+
|
|
26
|
+
/// Previously captured base map for the same cache key; when set, the base
|
|
27
|
+
/// render is skipped and the image is shown immediately.
|
|
28
|
+
@property(nonatomic, strong, nullable) UIImage *cachedBaseImage;
|
|
29
|
+
|
|
30
|
+
// State for subclasses
|
|
31
|
+
@property(nonatomic, readonly, nullable) UIView *wrapperView;
|
|
32
|
+
@property(nonatomic, readonly) CLLocationCoordinate2D coordinate;
|
|
33
|
+
@property(nonatomic, readonly) double zoom;
|
|
34
|
+
@property(nonatomic, readonly) MKMapRect mapRect;
|
|
35
|
+
@property(nonatomic, readonly) CGSize projectedSize;
|
|
36
|
+
@property(nonatomic, readonly) UIEdgeInsets edgeInsets;
|
|
37
|
+
@property(nonatomic, readonly) BOOL projectionReady;
|
|
38
|
+
@property(nonatomic, readonly) facebook::react::LuggMapViewMapType mapType;
|
|
39
|
+
@property(nonatomic, readonly) facebook::react::LuggMapViewTheme theme;
|
|
40
|
+
|
|
41
|
+
/// Shows the base image below the overlays, emits the static snapshot
|
|
42
|
+
/// delegate callbacks and marks the base render done.
|
|
43
|
+
- (void)displayBaseImage:(UIImage *)image fromCache:(BOOL)fromCache;
|
|
44
|
+
|
|
45
|
+
/// Discards any cached, displayed or in-flight base render and renders
|
|
46
|
+
/// again at the current camera. The displayed image stays until the new
|
|
47
|
+
/// one replaces it.
|
|
48
|
+
- (void)rerenderBaseMap;
|
|
49
|
+
|
|
50
|
+
/// Shows the marker and shape overlays (idempotent). Called automatically
|
|
51
|
+
/// when the base image displays; subclasses whose base map is already
|
|
52
|
+
/// visible earlier (e.g. a live warmup map) can call it sooner.
|
|
53
|
+
- (void)revealOverlays;
|
|
54
|
+
|
|
55
|
+
#pragma mark - Subclass hooks
|
|
56
|
+
|
|
57
|
+
/// The map rect the base render covers for the given view size; must match
|
|
58
|
+
/// the SDK's camera framing so overlays align with the base map exactly.
|
|
59
|
+
- (MKMapRect)mapRectForSize:(CGSize)size;
|
|
60
|
+
|
|
61
|
+
/// Overlay view shown for markers without a custom child view.
|
|
62
|
+
- (UIView *)newDefaultMarkerOverlayView;
|
|
63
|
+
|
|
64
|
+
/// Zoom level at which the base map renders at the given scale (map points
|
|
65
|
+
/// per view point) for the current coordinate and view size; the inverse of
|
|
66
|
+
/// mapRectForSize. Used by fitCoordinates.
|
|
67
|
+
- (double)zoomForMapPointsPerPoint:(double)mapPointsPerPoint;
|
|
68
|
+
|
|
69
|
+
/// Starts rendering the base map for the current projection (guaranteed
|
|
70
|
+
/// projectionReady, no cached image). Called after mount (once initial
|
|
71
|
+
/// props have applied), after a resize, and from resumeAnimations to retry
|
|
72
|
+
/// a failed or cancelled render (e.g. device back online).
|
|
73
|
+
- (void)renderBaseMap;
|
|
74
|
+
|
|
75
|
+
/// Cancels an in-flight base render (resize or teardown).
|
|
76
|
+
- (void)cancelBaseRender;
|
|
77
|
+
|
|
78
|
+
@end
|
|
79
|
+
|
|
80
|
+
NS_ASSUME_NONNULL_END
|