@lugg/maps 1.0.0-beta.3 → 1.0.0-beta.4
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/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 +9 -0
- package/android/src/main/java/com/luggmaps/LuggPackage.kt +4 -1
- 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 +289 -0
- package/android/src/main/java/com/luggmaps/core/MapProviderDelegate.kt +9 -0
- 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/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 +43 -0
- package/ios/LuggTileOverlayView.h +31 -0
- package/ios/LuggTileOverlayView.mm +130 -0
- package/ios/core/AppleMapProvider.mm +398 -1
- package/ios/core/GoogleMapProvider.mm +299 -10
- package/ios/core/MapProviderDelegate.h +12 -0
- package/ios/events/CirclePressEvent.h +20 -0
- package/ios/events/GroundOverlayPressEvent.h +20 -0
- package/ios/events/TileOverlayPressEvent.h +20 -0
- 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/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 +5 -1
- package/lib/module/components/Marker.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/LuggCircleViewNativeComponent.ts +25 -0
- package/lib/module/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
- 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/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/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.map +1 -1
- package/lib/typescript/src/components/Marker.types.d.ts +4 -1
- package/lib/typescript/src/components/Marker.types.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 +6 -0
- 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/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/LuggTileOverlayViewNativeComponent.d.ts +21 -0
- package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +6 -0
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/components/Circle.tsx +52 -0
- package/src/components/Circle.types.ts +33 -0
- package/src/components/Circle.web.tsx +93 -0
- package/src/components/GroundOverlay.tsx +47 -0
- package/src/components/GroundOverlay.types.ts +36 -0
- package/src/components/GroundOverlay.web.tsx +85 -0
- package/src/components/Marker.tsx +4 -1
- package/src/components/Marker.types.ts +4 -1
- package/src/components/TileOverlay.tsx +44 -0
- package/src/components/TileOverlay.types.ts +37 -0
- package/src/components/TileOverlay.web.tsx +95 -0
- package/src/components/index.ts +9 -0
- package/src/components/index.web.ts +9 -0
- package/src/fabric/LuggCircleViewNativeComponent.ts +25 -0
- package/src/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
- package/src/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
- package/src/index.ts +6 -0
- package/src/index.web.ts +12 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
#import "GoogleMapProvider.h"
|
|
2
2
|
#import "../LuggCalloutView.h"
|
|
3
|
+
#import "../LuggCircleView.h"
|
|
4
|
+
#import "../LuggGroundOverlayView.h"
|
|
3
5
|
#import "../LuggMarkerView.h"
|
|
4
6
|
#import "../LuggPolygonView.h"
|
|
5
7
|
#import "../LuggPolylineView.h"
|
|
8
|
+
#import "../LuggTileOverlayView.h"
|
|
6
9
|
#import "GMSPolylineAnimator.h"
|
|
7
10
|
#import "PolylineAnimatorBase.h"
|
|
8
11
|
|
|
@@ -10,7 +13,8 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
10
13
|
|
|
11
14
|
@interface GoogleMapProvider () <
|
|
12
15
|
LuggMarkerViewDelegate, LuggCalloutViewDelegate, LuggPolylineViewDelegate,
|
|
13
|
-
LuggPolygonViewDelegate
|
|
16
|
+
LuggPolygonViewDelegate, LuggCircleViewDelegate,
|
|
17
|
+
LuggGroundOverlayViewDelegate, LuggTileOverlayViewDelegate>
|
|
14
18
|
@end
|
|
15
19
|
|
|
16
20
|
@implementation GoogleMapProvider {
|
|
@@ -23,9 +27,15 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
23
27
|
NSMutableArray<LuggMarkerView *> *_pendingMarkerViews;
|
|
24
28
|
NSMutableArray<LuggPolylineView *> *_pendingPolylineViews;
|
|
25
29
|
NSMutableArray<LuggPolygonView *> *_pendingPolygonViews;
|
|
30
|
+
NSMutableArray<LuggCircleView *> *_pendingCircleViews;
|
|
31
|
+
NSMutableArray<LuggGroundOverlayView *> *_pendingGroundOverlayViews;
|
|
32
|
+
NSMutableArray<LuggTileOverlayView *> *_pendingTileOverlayViews;
|
|
26
33
|
NSMapTable<LuggPolylineView *, GMSPolylineAnimator *> *_polylineAnimators;
|
|
27
34
|
NSMapTable<GMSPolygon *, LuggPolygonView *> *_polygonToViewMap;
|
|
35
|
+
NSMapTable<GMSCircle *, LuggCircleView *> *_circleToViewMap;
|
|
28
36
|
NSMapTable<GMSMarker *, LuggMarkerView *> *_markerToViewMap;
|
|
37
|
+
NSMapTable<GMSGroundOverlay *, LuggGroundOverlayView *>
|
|
38
|
+
*_groundOverlayToViewMap;
|
|
29
39
|
LuggMarkerView *_activeNonBubbledMarker;
|
|
30
40
|
|
|
31
41
|
// Edge insets animation
|
|
@@ -45,9 +55,14 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
45
55
|
_pendingMarkerViews = [NSMutableArray array];
|
|
46
56
|
_pendingPolylineViews = [NSMutableArray array];
|
|
47
57
|
_pendingPolygonViews = [NSMutableArray array];
|
|
58
|
+
_pendingCircleViews = [NSMutableArray array];
|
|
59
|
+
_pendingGroundOverlayViews = [NSMutableArray array];
|
|
60
|
+
_pendingTileOverlayViews = [NSMutableArray array];
|
|
48
61
|
_polylineAnimators = [NSMapTable weakToStrongObjectsMapTable];
|
|
49
62
|
_polygonToViewMap = [NSMapTable strongToWeakObjectsMapTable];
|
|
63
|
+
_circleToViewMap = [NSMapTable strongToWeakObjectsMapTable];
|
|
50
64
|
_markerToViewMap = [NSMapTable strongToWeakObjectsMapTable];
|
|
65
|
+
_groundOverlayToViewMap = [NSMapTable strongToWeakObjectsMapTable];
|
|
51
66
|
}
|
|
52
67
|
return self;
|
|
53
68
|
}
|
|
@@ -101,6 +116,9 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
101
116
|
[self processPendingMarkers];
|
|
102
117
|
[self processPendingPolylines];
|
|
103
118
|
[self processPendingPolygons];
|
|
119
|
+
[self processPendingCircles];
|
|
120
|
+
[self processPendingGroundOverlays];
|
|
121
|
+
[self processPendingTileOverlays];
|
|
104
122
|
|
|
105
123
|
[_delegate mapProviderDidReady];
|
|
106
124
|
}
|
|
@@ -110,9 +128,14 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
110
128
|
[_pendingMarkerViews removeAllObjects];
|
|
111
129
|
[_pendingPolylineViews removeAllObjects];
|
|
112
130
|
[_pendingPolygonViews removeAllObjects];
|
|
131
|
+
[_pendingCircleViews removeAllObjects];
|
|
132
|
+
[_pendingGroundOverlayViews removeAllObjects];
|
|
133
|
+
[_pendingTileOverlayViews removeAllObjects];
|
|
113
134
|
[_polylineAnimators removeAllObjects];
|
|
114
135
|
[_polygonToViewMap removeAllObjects];
|
|
136
|
+
[_circleToViewMap removeAllObjects];
|
|
115
137
|
[_markerToViewMap removeAllObjects];
|
|
138
|
+
[_groundOverlayToViewMap removeAllObjects];
|
|
116
139
|
[_mapView clear];
|
|
117
140
|
[_mapView removeFromSuperview];
|
|
118
141
|
_mapView = nil;
|
|
@@ -291,15 +314,26 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
291
314
|
}
|
|
292
315
|
|
|
293
316
|
- (void)mapView:(GMSMapView *)mapView didTapOverlay:(GMSOverlay *)overlay {
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
317
|
+
if ([overlay isKindOfClass:[GMSPolygon class]]) {
|
|
318
|
+
GMSPolygon *polygon = (GMSPolygon *)overlay;
|
|
319
|
+
LuggPolygonView *polygonView = [_polygonToViewMap objectForKey:polygon];
|
|
320
|
+
if (polygonView && polygonView.tappable) {
|
|
321
|
+
[polygonView emitPressEvent];
|
|
322
|
+
}
|
|
323
|
+
} else if ([overlay isKindOfClass:[GMSCircle class]]) {
|
|
324
|
+
GMSCircle *circle = (GMSCircle *)overlay;
|
|
325
|
+
LuggCircleView *circleView = [_circleToViewMap objectForKey:circle];
|
|
326
|
+
if (circleView && circleView.tappable) {
|
|
327
|
+
[circleView emitPressEvent];
|
|
328
|
+
}
|
|
329
|
+
} else if ([overlay isKindOfClass:[GMSGroundOverlay class]]) {
|
|
330
|
+
GMSGroundOverlay *groundOverlay = (GMSGroundOverlay *)overlay;
|
|
331
|
+
LuggGroundOverlayView *groundOverlayView =
|
|
332
|
+
[_groundOverlayToViewMap objectForKey:groundOverlay];
|
|
333
|
+
if (groundOverlayView && groundOverlayView.tappable) {
|
|
334
|
+
[groundOverlayView emitPressEvent];
|
|
335
|
+
}
|
|
336
|
+
}
|
|
303
337
|
}
|
|
304
338
|
|
|
305
339
|
- (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker {
|
|
@@ -475,6 +509,24 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
475
509
|
[self syncPolygonView:polygonView];
|
|
476
510
|
}
|
|
477
511
|
|
|
512
|
+
#pragma mark - CircleViewDelegate
|
|
513
|
+
|
|
514
|
+
- (void)circleViewDidUpdate:(LuggCircleView *)circleView {
|
|
515
|
+
[self syncCircleView:circleView];
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
#pragma mark - GroundOverlayViewDelegate
|
|
519
|
+
|
|
520
|
+
- (void)groundOverlayViewDidUpdate:(LuggGroundOverlayView *)groundOverlayView {
|
|
521
|
+
[self syncGroundOverlayView:groundOverlayView];
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
#pragma mark - TileOverlayViewDelegate
|
|
525
|
+
|
|
526
|
+
- (void)tileOverlayViewDidUpdate:(LuggTileOverlayView *)tileOverlayView {
|
|
527
|
+
[self syncTileOverlayView:tileOverlayView];
|
|
528
|
+
}
|
|
529
|
+
|
|
478
530
|
#pragma mark - Marker Management
|
|
479
531
|
|
|
480
532
|
- (void)addMarkerView:(LuggMarkerView *)markerView {
|
|
@@ -739,6 +791,243 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
739
791
|
[_polygonToViewMap setObject:polygonView forKey:polygon];
|
|
740
792
|
}
|
|
741
793
|
|
|
794
|
+
#pragma mark - Circle Management
|
|
795
|
+
|
|
796
|
+
- (void)addCircleView:(LuggCircleView *)circleView {
|
|
797
|
+
circleView.delegate = self;
|
|
798
|
+
[self syncCircleView:circleView];
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
- (void)removeCircleView:(LuggCircleView *)circleView {
|
|
802
|
+
GMSCircle *circle = (GMSCircle *)circleView.circle;
|
|
803
|
+
if (circle) {
|
|
804
|
+
[_circleToViewMap removeObjectForKey:circle];
|
|
805
|
+
circle.map = nil;
|
|
806
|
+
circleView.circle = nil;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
- (void)syncCircleView:(LuggCircleView *)circleView {
|
|
811
|
+
if (!_mapView) {
|
|
812
|
+
if (![_pendingCircleViews containsObject:circleView]) {
|
|
813
|
+
[_pendingCircleViews addObject:circleView];
|
|
814
|
+
}
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
if (!circleView.circle) {
|
|
819
|
+
[self addCircleViewToMap:circleView];
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
GMSCircle *circle = (GMSCircle *)circleView.circle;
|
|
824
|
+
circle.position = circleView.center;
|
|
825
|
+
circle.radius = circleView.radius;
|
|
826
|
+
circle.fillColor = circleView.fillColor;
|
|
827
|
+
circle.strokeColor = circleView.strokeColor;
|
|
828
|
+
circle.strokeWidth = circleView.strokeWidth;
|
|
829
|
+
circle.zIndex = (int)circleView.zIndex;
|
|
830
|
+
circle.tappable = circleView.tappable;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
- (void)processPendingCircles {
|
|
834
|
+
if (!_mapView)
|
|
835
|
+
return;
|
|
836
|
+
|
|
837
|
+
for (LuggCircleView *circleView in _pendingCircleViews) {
|
|
838
|
+
[self addCircleViewToMap:circleView];
|
|
839
|
+
}
|
|
840
|
+
[_pendingCircleViews removeAllObjects];
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
- (void)addCircleViewToMap:(LuggCircleView *)circleView {
|
|
844
|
+
if (!_mapView)
|
|
845
|
+
return;
|
|
846
|
+
|
|
847
|
+
GMSCircle *circle = [GMSCircle circleWithPosition:circleView.center
|
|
848
|
+
radius:circleView.radius];
|
|
849
|
+
circle.fillColor = circleView.fillColor;
|
|
850
|
+
circle.strokeColor = circleView.strokeColor;
|
|
851
|
+
circle.strokeWidth = circleView.strokeWidth;
|
|
852
|
+
circle.zIndex = (int)circleView.zIndex;
|
|
853
|
+
circle.tappable = circleView.tappable;
|
|
854
|
+
circle.map = _mapView;
|
|
855
|
+
circleView.circle = circle;
|
|
856
|
+
[_circleToViewMap setObject:circleView forKey:circle];
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
#pragma mark - Ground Overlay Management
|
|
860
|
+
|
|
861
|
+
- (void)addGroundOverlayView:(LuggGroundOverlayView *)groundOverlayView {
|
|
862
|
+
groundOverlayView.delegate = self;
|
|
863
|
+
[self syncGroundOverlayView:groundOverlayView];
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
- (void)removeGroundOverlayView:(LuggGroundOverlayView *)groundOverlayView {
|
|
867
|
+
groundOverlayView.delegate = nil;
|
|
868
|
+
GMSGroundOverlay *overlay = (GMSGroundOverlay *)groundOverlayView.overlay;
|
|
869
|
+
if (overlay) {
|
|
870
|
+
[_groundOverlayToViewMap removeObjectForKey:overlay];
|
|
871
|
+
overlay.map = nil;
|
|
872
|
+
groundOverlayView.overlay = nil;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
- (void)syncGroundOverlayView:(LuggGroundOverlayView *)groundOverlayView {
|
|
877
|
+
if (!_mapView) {
|
|
878
|
+
if (![_pendingGroundOverlayViews containsObject:groundOverlayView]) {
|
|
879
|
+
[_pendingGroundOverlayViews addObject:groundOverlayView];
|
|
880
|
+
}
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
NSString *imageUri = groundOverlayView.imageUri;
|
|
885
|
+
if (imageUri.length == 0)
|
|
886
|
+
return;
|
|
887
|
+
|
|
888
|
+
// Remove old overlay
|
|
889
|
+
GMSGroundOverlay *oldOverlay = (GMSGroundOverlay *)groundOverlayView.overlay;
|
|
890
|
+
if (oldOverlay) {
|
|
891
|
+
[_groundOverlayToViewMap removeObjectForKey:oldOverlay];
|
|
892
|
+
oldOverlay.map = nil;
|
|
893
|
+
groundOverlayView.overlay = nil;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
// Load image and create overlay
|
|
897
|
+
NSURL *url = [NSURL URLWithString:imageUri];
|
|
898
|
+
if (!url)
|
|
899
|
+
return;
|
|
900
|
+
|
|
901
|
+
__weak __typeof(self) weakSelf = self;
|
|
902
|
+
__weak LuggGroundOverlayView *weakOverlayView = groundOverlayView;
|
|
903
|
+
dispatch_async(
|
|
904
|
+
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
905
|
+
NSData *data = [NSData dataWithContentsOfURL:url];
|
|
906
|
+
UIImage *image = data ? [UIImage imageWithData:data] : nil;
|
|
907
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
908
|
+
[weakSelf addGroundOverlayToMap:weakOverlayView image:image];
|
|
909
|
+
});
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
- (void)addGroundOverlayToMap:(LuggGroundOverlayView *)groundOverlayView
|
|
914
|
+
image:(UIImage *)image {
|
|
915
|
+
if (!_mapView || !groundOverlayView || !image)
|
|
916
|
+
return;
|
|
917
|
+
|
|
918
|
+
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc]
|
|
919
|
+
initWithCoordinate:groundOverlayView.southwest
|
|
920
|
+
coordinate:groundOverlayView.northeast];
|
|
921
|
+
|
|
922
|
+
GMSGroundOverlay *overlay = [GMSGroundOverlay groundOverlayWithBounds:bounds
|
|
923
|
+
icon:image];
|
|
924
|
+
overlay.opacity = groundOverlayView.opacity;
|
|
925
|
+
overlay.bearing = groundOverlayView.bearing;
|
|
926
|
+
overlay.zIndex = (int)groundOverlayView.zIndex;
|
|
927
|
+
overlay.tappable = groundOverlayView.tappable;
|
|
928
|
+
overlay.map = _mapView;
|
|
929
|
+
|
|
930
|
+
groundOverlayView.overlay = overlay;
|
|
931
|
+
[_groundOverlayToViewMap setObject:groundOverlayView forKey:overlay];
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
- (void)processPendingGroundOverlays {
|
|
935
|
+
if (!_mapView)
|
|
936
|
+
return;
|
|
937
|
+
|
|
938
|
+
for (LuggGroundOverlayView *view in _pendingGroundOverlayViews) {
|
|
939
|
+
[self syncGroundOverlayView:view];
|
|
940
|
+
}
|
|
941
|
+
[_pendingGroundOverlayViews removeAllObjects];
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
#pragma mark - Tile Overlay Management
|
|
945
|
+
|
|
946
|
+
- (void)addTileOverlayView:(LuggTileOverlayView *)tileOverlayView {
|
|
947
|
+
tileOverlayView.delegate = self;
|
|
948
|
+
[self syncTileOverlayView:tileOverlayView];
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
- (void)removeTileOverlayView:(LuggTileOverlayView *)tileOverlayView {
|
|
952
|
+
tileOverlayView.delegate = nil;
|
|
953
|
+
GMSTileLayer *tileLayer = (GMSTileLayer *)tileOverlayView.overlay;
|
|
954
|
+
if (tileLayer) {
|
|
955
|
+
tileLayer.map = nil;
|
|
956
|
+
tileOverlayView.overlay = nil;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
- (void)syncTileOverlayView:(LuggTileOverlayView *)tileOverlayView {
|
|
961
|
+
if (!_mapView) {
|
|
962
|
+
if (![_pendingTileOverlayViews containsObject:tileOverlayView]) {
|
|
963
|
+
[_pendingTileOverlayViews addObject:tileOverlayView];
|
|
964
|
+
}
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
NSString *urlTemplate = tileOverlayView.urlTemplate;
|
|
969
|
+
if (urlTemplate.length == 0)
|
|
970
|
+
return;
|
|
971
|
+
|
|
972
|
+
// Remove old tile layer
|
|
973
|
+
GMSTileLayer *oldLayer = (GMSTileLayer *)tileOverlayView.overlay;
|
|
974
|
+
if (oldLayer) {
|
|
975
|
+
oldLayer.map = nil;
|
|
976
|
+
tileOverlayView.overlay = nil;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
BOOL hasBounds = tileOverlayView.hasBounds;
|
|
980
|
+
CLLocationCoordinate2D sw = tileOverlayView.southwest;
|
|
981
|
+
CLLocationCoordinate2D ne = tileOverlayView.northeast;
|
|
982
|
+
|
|
983
|
+
GMSTileURLConstructor constructor = ^NSURL *(NSUInteger x, NSUInteger y,
|
|
984
|
+
NSUInteger zoom) {
|
|
985
|
+
if (hasBounds) {
|
|
986
|
+
double n = pow(2.0, zoom);
|
|
987
|
+
double tileSW_lat =
|
|
988
|
+
180.0 / M_PI * atan(sinh(M_PI * (1 - 2.0 * (y + 1) / n)));
|
|
989
|
+
double tileNE_lat = 180.0 / M_PI * atan(sinh(M_PI * (1 - 2.0 * y / n)));
|
|
990
|
+
double tileSW_lng = x / n * 360.0 - 180.0;
|
|
991
|
+
double tileNE_lng = (x + 1) / n * 360.0 - 180.0;
|
|
992
|
+
|
|
993
|
+
if (tileNE_lat < sw.latitude || tileSW_lat > ne.latitude ||
|
|
994
|
+
tileNE_lng < sw.longitude || tileSW_lng > ne.longitude) {
|
|
995
|
+
return nil;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
NSString *urlString =
|
|
1000
|
+
[urlTemplate stringByReplacingOccurrencesOfString:@"{x}"
|
|
1001
|
+
withString:[@(x) stringValue]];
|
|
1002
|
+
urlString =
|
|
1003
|
+
[urlString stringByReplacingOccurrencesOfString:@"{y}"
|
|
1004
|
+
withString:[@(y) stringValue]];
|
|
1005
|
+
urlString =
|
|
1006
|
+
[urlString stringByReplacingOccurrencesOfString:@"{z}"
|
|
1007
|
+
withString:[@(zoom) stringValue]];
|
|
1008
|
+
return [NSURL URLWithString:urlString];
|
|
1009
|
+
};
|
|
1010
|
+
|
|
1011
|
+
GMSURLTileLayer *tileLayer =
|
|
1012
|
+
[GMSURLTileLayer tileLayerWithURLConstructor:constructor];
|
|
1013
|
+
tileLayer.tileSize = tileOverlayView.tileSize;
|
|
1014
|
+
tileLayer.opacity = tileOverlayView.opacity;
|
|
1015
|
+
tileLayer.zIndex = (int)tileOverlayView.zIndex;
|
|
1016
|
+
tileLayer.map = _mapView;
|
|
1017
|
+
|
|
1018
|
+
tileOverlayView.overlay = tileLayer;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
- (void)processPendingTileOverlays {
|
|
1022
|
+
if (!_mapView)
|
|
1023
|
+
return;
|
|
1024
|
+
|
|
1025
|
+
for (LuggTileOverlayView *view in _pendingTileOverlayViews) {
|
|
1026
|
+
[self syncTileOverlayView:view];
|
|
1027
|
+
}
|
|
1028
|
+
[_pendingTileOverlayViews removeAllObjects];
|
|
1029
|
+
}
|
|
1030
|
+
|
|
742
1031
|
#pragma mark - Lifecycle
|
|
743
1032
|
|
|
744
1033
|
- (void)pauseAnimations {
|
|
@@ -6,6 +6,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
6
6
|
@class LuggMarkerView;
|
|
7
7
|
@class LuggPolylineView;
|
|
8
8
|
@class LuggPolygonView;
|
|
9
|
+
@class LuggCircleView;
|
|
10
|
+
@class LuggGroundOverlayView;
|
|
11
|
+
@class LuggTileOverlayView;
|
|
9
12
|
|
|
10
13
|
@protocol MapProviderDelegate <NSObject>
|
|
11
14
|
- (void)mapProviderDidReady;
|
|
@@ -62,6 +65,15 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
62
65
|
- (void)addPolygonView:(LuggPolygonView *)polygonView;
|
|
63
66
|
- (void)removePolygonView:(LuggPolygonView *)polygonView;
|
|
64
67
|
- (void)syncPolygonView:(LuggPolygonView *)polygonView;
|
|
68
|
+
- (void)addCircleView:(LuggCircleView *)circleView;
|
|
69
|
+
- (void)removeCircleView:(LuggCircleView *)circleView;
|
|
70
|
+
- (void)syncCircleView:(LuggCircleView *)circleView;
|
|
71
|
+
- (void)addGroundOverlayView:(LuggGroundOverlayView *)groundOverlayView;
|
|
72
|
+
- (void)removeGroundOverlayView:(LuggGroundOverlayView *)groundOverlayView;
|
|
73
|
+
- (void)syncGroundOverlayView:(LuggGroundOverlayView *)groundOverlayView;
|
|
74
|
+
- (void)addTileOverlayView:(LuggTileOverlayView *)tileOverlayView;
|
|
75
|
+
- (void)removeTileOverlayView:(LuggTileOverlayView *)tileOverlayView;
|
|
76
|
+
- (void)syncTileOverlayView:(LuggTileOverlayView *)tileOverlayView;
|
|
65
77
|
|
|
66
78
|
// Lifecycle
|
|
67
79
|
- (void)pauseAnimations;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/RNMapsSpec/EventEmitters.h>
|
|
4
|
+
|
|
5
|
+
namespace luggmaps {
|
|
6
|
+
namespace events {
|
|
7
|
+
|
|
8
|
+
struct CirclePressEvent {
|
|
9
|
+
template <typename Emitter>
|
|
10
|
+
static void emit(const facebook::react::SharedEventEmitter &eventEmitter) {
|
|
11
|
+
if (!eventEmitter)
|
|
12
|
+
return;
|
|
13
|
+
auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
|
|
14
|
+
typename Emitter::OnCirclePress event;
|
|
15
|
+
emitter->onCirclePress(event);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
} // namespace events
|
|
20
|
+
} // namespace luggmaps
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/RNMapsSpec/EventEmitters.h>
|
|
4
|
+
|
|
5
|
+
namespace luggmaps {
|
|
6
|
+
namespace events {
|
|
7
|
+
|
|
8
|
+
struct GroundOverlayPressEvent {
|
|
9
|
+
template <typename Emitter>
|
|
10
|
+
static void emit(const facebook::react::SharedEventEmitter &eventEmitter) {
|
|
11
|
+
if (!eventEmitter)
|
|
12
|
+
return;
|
|
13
|
+
auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
|
|
14
|
+
typename Emitter::OnGroundOverlayPress event;
|
|
15
|
+
emitter->onGroundOverlayPress(event);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
} // namespace events
|
|
20
|
+
} // namespace luggmaps
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/RNMapsSpec/EventEmitters.h>
|
|
4
|
+
|
|
5
|
+
namespace luggmaps {
|
|
6
|
+
namespace events {
|
|
7
|
+
|
|
8
|
+
struct TileOverlayPressEvent {
|
|
9
|
+
template <typename Emitter>
|
|
10
|
+
static void emit(const facebook::react::SharedEventEmitter &eventEmitter) {
|
|
11
|
+
if (!eventEmitter)
|
|
12
|
+
return;
|
|
13
|
+
auto emitter = std::static_pointer_cast<Emitter const>(eventEmitter);
|
|
14
|
+
typename Emitter::OnTileOverlayPress event;
|
|
15
|
+
emitter->onTileOverlayPress(event);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
} // namespace events
|
|
20
|
+
} // namespace luggmaps
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet } from 'react-native';
|
|
5
|
+
import LuggCircleViewNativeComponent from '../fabric/LuggCircleViewNativeComponent';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export class Circle extends React.PureComponent {
|
|
8
|
+
getStyle(zIndex) {
|
|
9
|
+
if (zIndex == null) return styles.circle;
|
|
10
|
+
if (zIndex !== this._cachedZIndex) {
|
|
11
|
+
this._cachedZIndex = zIndex;
|
|
12
|
+
this._cachedStyle = [{
|
|
13
|
+
zIndex
|
|
14
|
+
}, styles.circle];
|
|
15
|
+
}
|
|
16
|
+
return this._cachedStyle;
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
const {
|
|
20
|
+
center,
|
|
21
|
+
radius,
|
|
22
|
+
strokeColor,
|
|
23
|
+
strokeWidth,
|
|
24
|
+
fillColor,
|
|
25
|
+
zIndex,
|
|
26
|
+
onPress
|
|
27
|
+
} = this.props;
|
|
28
|
+
return /*#__PURE__*/_jsx(LuggCircleViewNativeComponent, {
|
|
29
|
+
style: this.getStyle(zIndex),
|
|
30
|
+
center: center,
|
|
31
|
+
radius: radius,
|
|
32
|
+
strokeColor: strokeColor,
|
|
33
|
+
strokeWidth: strokeWidth,
|
|
34
|
+
fillColor: fillColor,
|
|
35
|
+
tappable: !!onPress,
|
|
36
|
+
onCirclePress: onPress
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const styles = StyleSheet.create({
|
|
41
|
+
circle: {
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
pointerEvents: 'none'
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=Circle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","LuggCircleViewNativeComponent","jsx","_jsx","Circle","PureComponent","getStyle","zIndex","styles","circle","_cachedZIndex","_cachedStyle","render","center","radius","strokeColor","strokeWidth","fillColor","onPress","props","style","tappable","onCirclePress","create","position","pointerEvents"],"sourceRoot":"../../../src","sources":["components/Circle.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,cAAc;AACzC,OAAOC,6BAA6B,MAAM,yCAAyC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAKpF,OAAO,MAAMC,MAAM,SAASL,KAAK,CAACM,aAAa,CAAc;EAInDC,QAAQA,CAACC,MAA0B,EAAE;IAC3C,IAAIA,MAAM,IAAI,IAAI,EAAE,OAAOC,MAAM,CAACC,MAAM;IACxC,IAAIF,MAAM,KAAK,IAAI,CAACG,aAAa,EAAE;MACjC,IAAI,CAACA,aAAa,GAAGH,MAAM;MAC3B,IAAI,CAACI,YAAY,GAAG,CAAC;QAAEJ;MAAO,CAAC,EAAEC,MAAM,CAACC,MAAM,CAAC;IACjD;IACA,OAAO,IAAI,CAACE,YAAY;EAC1B;EAEAC,MAAMA,CAAA,EAAG;IACP,MAAM;MACJC,MAAM;MACNC,MAAM;MACNC,WAAW;MACXC,WAAW;MACXC,SAAS;MACTV,MAAM;MACNW;IACF,CAAC,GAAG,IAAI,CAACC,KAAK;IAEd,oBACEhB,IAAA,CAACF,6BAA6B;MAC5BmB,KAAK,EAAE,IAAI,CAACd,QAAQ,CAACC,MAAM,CAAE;MAC7BM,MAAM,EAAEA,MAAO;MACfC,MAAM,EAAEA,MAAO;MACfC,WAAW,EAAEA,WAAY;MACzBC,WAAW,EAAEA,WAAY;MACzBC,SAAS,EAAEA,SAAU;MACrBI,QAAQ,EAAE,CAAC,CAACH,OAAQ;MACpBI,aAAa,EAAEJ;IAAQ,CACxB,CAAC;EAEN;AACF;AAEA,MAAMV,MAAM,GAAGR,UAAU,CAACuB,MAAM,CAAC;EAC/Bd,MAAM,EAAE;IACNe,QAAQ,EAAE,UAAU;IACpBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/Circle.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
4
|
+
import { useMapContext } from "../MapProvider.web.js";
|
|
5
|
+
export const Circle = ({
|
|
6
|
+
center,
|
|
7
|
+
radius,
|
|
8
|
+
strokeColor = '#000000',
|
|
9
|
+
strokeWidth = 1,
|
|
10
|
+
fillColor = 'rgba(0, 0, 0, 0.3)',
|
|
11
|
+
zIndex = 0,
|
|
12
|
+
onPress
|
|
13
|
+
}) => {
|
|
14
|
+
const {
|
|
15
|
+
map
|
|
16
|
+
} = useMapContext();
|
|
17
|
+
const circleRef = useRef(null);
|
|
18
|
+
const listenersRef = useRef([]);
|
|
19
|
+
const handleClick = useCallback(() => {
|
|
20
|
+
onPress?.();
|
|
21
|
+
}, [onPress]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
return () => {
|
|
24
|
+
listenersRef.current.forEach(l => l.remove());
|
|
25
|
+
listenersRef.current = [];
|
|
26
|
+
circleRef.current?.setMap(null);
|
|
27
|
+
circleRef.current = null;
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const circle = circleRef.current;
|
|
32
|
+
if (!circle) return;
|
|
33
|
+
listenersRef.current.forEach(l => l.remove());
|
|
34
|
+
listenersRef.current = [];
|
|
35
|
+
if (onPress) {
|
|
36
|
+
listenersRef.current.push(circle.addListener('click', handleClick));
|
|
37
|
+
}
|
|
38
|
+
circle.set('clickable', !!onPress);
|
|
39
|
+
}, [onPress, handleClick]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!map) {
|
|
42
|
+
circleRef.current?.setMap(null);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const googleCenter = {
|
|
46
|
+
lat: center.latitude,
|
|
47
|
+
lng: center.longitude
|
|
48
|
+
};
|
|
49
|
+
if (circleRef.current) {
|
|
50
|
+
circleRef.current.setCenter(googleCenter);
|
|
51
|
+
circleRef.current.setRadius(radius);
|
|
52
|
+
circleRef.current.setOptions({
|
|
53
|
+
strokeColor: strokeColor,
|
|
54
|
+
strokeWeight: strokeWidth,
|
|
55
|
+
fillColor: fillColor,
|
|
56
|
+
zIndex
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
const circle = new google.maps.Circle({
|
|
60
|
+
center: googleCenter,
|
|
61
|
+
radius,
|
|
62
|
+
strokeColor: strokeColor,
|
|
63
|
+
strokeWeight: strokeWidth,
|
|
64
|
+
strokeOpacity: 1,
|
|
65
|
+
fillColor: fillColor,
|
|
66
|
+
fillOpacity: 1,
|
|
67
|
+
zIndex,
|
|
68
|
+
clickable: !!onPress,
|
|
69
|
+
map
|
|
70
|
+
});
|
|
71
|
+
circleRef.current = circle;
|
|
72
|
+
if (onPress) {
|
|
73
|
+
listenersRef.current.push(circle.addListener('click', handleClick));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, [map, center, radius, strokeColor, strokeWidth, fillColor, zIndex, onPress, handleClick]);
|
|
77
|
+
return null;
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=Circle.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useRef","useMapContext","Circle","center","radius","strokeColor","strokeWidth","fillColor","zIndex","onPress","map","circleRef","listenersRef","handleClick","current","forEach","l","remove","setMap","circle","push","addListener","set","googleCenter","lat","latitude","lng","longitude","setCenter","setRadius","setOptions","strokeWeight","google","maps","strokeOpacity","fillOpacity","clickable"],"sourceRoot":"../../../src","sources":["components/Circle.web.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Image, StyleSheet } from 'react-native';
|
|
5
|
+
import LuggGroundOverlayViewNativeComponent from '../fabric/LuggGroundOverlayViewNativeComponent';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export class GroundOverlay extends React.PureComponent {
|
|
8
|
+
getStyle(zIndex) {
|
|
9
|
+
if (zIndex == null) return styles.overlay;
|
|
10
|
+
if (zIndex !== this._cachedZIndex) {
|
|
11
|
+
this._cachedZIndex = zIndex;
|
|
12
|
+
this._cachedStyle = [{
|
|
13
|
+
zIndex
|
|
14
|
+
}, styles.overlay];
|
|
15
|
+
}
|
|
16
|
+
return this._cachedStyle;
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
const {
|
|
20
|
+
image,
|
|
21
|
+
bounds,
|
|
22
|
+
opacity,
|
|
23
|
+
bearing,
|
|
24
|
+
zIndex,
|
|
25
|
+
onPress
|
|
26
|
+
} = this.props;
|
|
27
|
+
const resolved = Image.resolveAssetSource(image);
|
|
28
|
+
return /*#__PURE__*/_jsx(LuggGroundOverlayViewNativeComponent, {
|
|
29
|
+
style: this.getStyle(zIndex),
|
|
30
|
+
image: resolved?.uri ?? '',
|
|
31
|
+
bounds: bounds,
|
|
32
|
+
opacity: opacity,
|
|
33
|
+
bearing: bearing,
|
|
34
|
+
tappable: !!onPress,
|
|
35
|
+
onGroundOverlayPress: onPress
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const styles = StyleSheet.create({
|
|
40
|
+
overlay: {
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
pointerEvents: 'none'
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=GroundOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Image","StyleSheet","LuggGroundOverlayViewNativeComponent","jsx","_jsx","GroundOverlay","PureComponent","getStyle","zIndex","styles","overlay","_cachedZIndex","_cachedStyle","render","image","bounds","opacity","bearing","onPress","props","resolved","resolveAssetSource","style","uri","tappable","onGroundOverlayPress","create","position","pointerEvents"],"sourceRoot":"../../../src","sources":["components/GroundOverlay.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,EAAEC,UAAU,QAAQ,cAAc;AAChD,OAAOC,oCAAoC,MAAM,gDAAgD;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQlG,OAAO,MAAMC,aAAa,SAASN,KAAK,CAACO,aAAa,CAAqB;EAIjEC,QAAQA,CAACC,MAA0B,EAAE;IAC3C,IAAIA,MAAM,IAAI,IAAI,EAAE,OAAOC,MAAM,CAACC,OAAO;IACzC,IAAIF,MAAM,KAAK,IAAI,CAACG,aAAa,EAAE;MACjC,IAAI,CAACA,aAAa,GAAGH,MAAM;MAC3B,IAAI,CAACI,YAAY,GAAG,CAAC;QAAEJ;MAAO,CAAC,EAAEC,MAAM,CAACC,OAAO,CAAC;IAClD;IACA,OAAO,IAAI,CAACE,YAAY;EAC1B;EAEAC,MAAMA,CAAA,EAAG;IACP,MAAM;MAAEC,KAAK;MAAEC,MAAM;MAAEC,OAAO;MAAEC,OAAO;MAAET,MAAM;MAAEU;IAAQ,CAAC,GAAG,IAAI,CAACC,KAAK;IACvE,MAAMC,QAAQ,GAAGpB,KAAK,CAACqB,kBAAkB,CAACP,KAAK,CAAC;IAEhD,oBACEV,IAAA,CAACF,oCAAoC;MACnCoB,KAAK,EAAE,IAAI,CAACf,QAAQ,CAACC,MAAM,CAAE;MAC7BM,KAAK,EAAEM,QAAQ,EAAEG,GAAG,IAAI,EAAG;MAC3BR,MAAM,EAAEA,MAAO;MACfC,OAAO,EAAEA,OAAQ;MACjBC,OAAO,EAAEA,OAAQ;MACjBO,QAAQ,EAAE,CAAC,CAACN,OAAQ;MACpBO,oBAAoB,EAAEP;IAAQ,CAC/B,CAAC;EAEN;AACF;AAEA,MAAMT,MAAM,GAAGR,UAAU,CAACyB,MAAM,CAAC;EAC/BhB,OAAO,EAAE;IACPiB,QAAQ,EAAE,UAAU;IACpBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/GroundOverlay.types.ts"],"mappings":"","ignoreList":[]}
|