@lugg/maps 0.2.0-alpha.5 → 0.2.0-alpha.6
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/android/src/main/java/com/luggmaps/LuggGoogleMapView.kt +2 -5
- package/android/src/main/java/com/luggmaps/LuggMarkerView.kt +7 -1
- package/android/src/main/java/com/luggmaps/LuggMarkerViewManager.kt +6 -0
- package/ios/LuggAppleMapView.mm +8 -0
- package/ios/LuggGoogleMapView.mm +2 -0
- package/ios/LuggMarkerView.h +2 -0
- package/ios/LuggMarkerView.mm +13 -0
- package/lib/module/components/Marker.js +4 -1
- package/lib/module/components/Marker.js.map +1 -1
- package/lib/typescript/src/components/Marker.d.ts +4 -0
- package/lib/typescript/src/components/Marker.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Marker.tsx +6 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
package com.luggmaps
|
|
2
2
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
|
-
import android.util.Log
|
|
5
4
|
import android.view.View
|
|
6
5
|
import android.view.ViewGroup
|
|
7
6
|
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
@@ -103,7 +102,6 @@ class LuggGoogleMapView(private val reactContext: ThemedReactContext) :
|
|
|
103
102
|
override fun removeViewAt(index: Int) {
|
|
104
103
|
val view = getChildAt(index)
|
|
105
104
|
if (view is LuggMarkerView) {
|
|
106
|
-
Log.d(TAG, "removing markerView: ${view.name}")
|
|
107
105
|
view.marker?.remove()
|
|
108
106
|
view.marker = null
|
|
109
107
|
} else if (view is LuggPolylineView) {
|
|
@@ -123,7 +121,6 @@ class LuggGoogleMapView(private val reactContext: ThemedReactContext) :
|
|
|
123
121
|
}
|
|
124
122
|
|
|
125
123
|
fun onDropViewInstance() {
|
|
126
|
-
Log.d(TAG, "dropping mapView instance")
|
|
127
124
|
pendingMarkerViews.clear()
|
|
128
125
|
pendingPolylineViews.clear()
|
|
129
126
|
polylineAnimators.values.forEach { it.destroy() }
|
|
@@ -282,6 +279,7 @@ class LuggGoogleMapView(private val reactContext: ThemedReactContext) :
|
|
|
282
279
|
title = markerView.title
|
|
283
280
|
snippet = markerView.description
|
|
284
281
|
setAnchor(markerView.anchorX, markerView.anchorY)
|
|
282
|
+
zIndex = markerView.zIndex
|
|
285
283
|
if (!markerView.hasCustomView) {
|
|
286
284
|
iconView = null
|
|
287
285
|
}
|
|
@@ -291,7 +289,6 @@ class LuggGoogleMapView(private val reactContext: ThemedReactContext) :
|
|
|
291
289
|
private fun processPendingMarkers() {
|
|
292
290
|
if (googleMap == null) return
|
|
293
291
|
|
|
294
|
-
Log.d(TAG, "processing pending markers ${pendingMarkerViews.size}")
|
|
295
292
|
pendingMarkerViews.forEach { addMarkerViewToMap(it) }
|
|
296
293
|
pendingMarkerViews.clear()
|
|
297
294
|
}
|
|
@@ -312,13 +309,13 @@ class LuggGoogleMapView(private val reactContext: ThemedReactContext) :
|
|
|
312
309
|
.title(markerView.title)
|
|
313
310
|
.snippet(markerView.description)
|
|
314
311
|
|
|
315
|
-
Log.d(TAG, "adding marker: ${markerView.name} customview: ${markerView.hasCustomView}")
|
|
316
312
|
if (markerView.hasCustomView) {
|
|
317
313
|
options.iconView(iconView)
|
|
318
314
|
}
|
|
319
315
|
|
|
320
316
|
val marker = map.addMarker(options) as AdvancedMarker
|
|
321
317
|
marker.setAnchor(markerView.anchorX, markerView.anchorY)
|
|
318
|
+
marker.zIndex = markerView.zIndex
|
|
322
319
|
|
|
323
320
|
markerView.marker = marker
|
|
324
321
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
package com.luggmaps
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
|
-
import android.util.Log
|
|
5
4
|
import android.view.View
|
|
6
5
|
import androidx.core.view.isNotEmpty
|
|
7
6
|
import com.facebook.react.views.view.ReactViewGroup
|
|
@@ -34,6 +33,9 @@ class LuggMarkerView(context: Context) : ReactViewGroup(context) {
|
|
|
34
33
|
var anchorY: Float = 1.0f
|
|
35
34
|
private set
|
|
36
35
|
|
|
36
|
+
var zIndex: Float = 0f
|
|
37
|
+
private set
|
|
38
|
+
|
|
37
39
|
var didLayout: Boolean = false
|
|
38
40
|
private set
|
|
39
41
|
|
|
@@ -114,6 +116,10 @@ class LuggMarkerView(context: Context) : ReactViewGroup(context) {
|
|
|
114
116
|
anchorY = y.toFloat()
|
|
115
117
|
}
|
|
116
118
|
|
|
119
|
+
fun setZIndex(zIndex: Float) {
|
|
120
|
+
this.zIndex = zIndex
|
|
121
|
+
}
|
|
122
|
+
|
|
117
123
|
fun setName(name: String?) {
|
|
118
124
|
this.name = name
|
|
119
125
|
}
|
|
@@ -63,6 +63,12 @@ class LuggMarkerViewManager :
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
@ReactProp(name = "zIndex", defaultFloat = 0f)
|
|
67
|
+
override fun setZIndex(view: LuggMarkerView, zIndex: Float) {
|
|
68
|
+
super.setZIndex(view, zIndex)
|
|
69
|
+
view.setZIndex(zIndex)
|
|
70
|
+
}
|
|
71
|
+
|
|
66
72
|
companion object {
|
|
67
73
|
const val NAME = "LuggMarkerView"
|
|
68
74
|
}
|
package/ios/LuggAppleMapView.mm
CHANGED
|
@@ -393,6 +393,12 @@ using namespace luggmaps::events;
|
|
|
393
393
|
annotation.title = markerView.title;
|
|
394
394
|
annotation.subtitle = markerView.markerDescription;
|
|
395
395
|
|
|
396
|
+
MKAnnotationView *annotationView = annotation.annotationView;
|
|
397
|
+
if (annotationView) {
|
|
398
|
+
annotationView.layer.zPosition = markerView.zIndex;
|
|
399
|
+
annotationView.zPriority = markerView.zIndex;
|
|
400
|
+
}
|
|
401
|
+
|
|
396
402
|
[self updateAnnotationViewFrame:annotation];
|
|
397
403
|
}
|
|
398
404
|
|
|
@@ -447,6 +453,8 @@ using namespace luggmaps::events;
|
|
|
447
453
|
reuseIdentifier:nil];
|
|
448
454
|
annotationView.canShowCallout = YES;
|
|
449
455
|
annotationView.displayPriority = MKFeatureDisplayPriorityRequired;
|
|
456
|
+
annotationView.layer.zPosition = markerView.zIndex;
|
|
457
|
+
annotationView.zPriority = markerView.zIndex;
|
|
450
458
|
|
|
451
459
|
UIView *iconView = markerView.iconView;
|
|
452
460
|
[iconView removeFromSuperview];
|
package/ios/LuggGoogleMapView.mm
CHANGED
|
@@ -242,6 +242,7 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
242
242
|
marker.position = markerView.coordinate;
|
|
243
243
|
marker.title = markerView.title;
|
|
244
244
|
marker.snippet = markerView.markerDescription;
|
|
245
|
+
marker.zIndex = (int)markerView.zIndex;
|
|
245
246
|
if (markerView.hasCustomView) {
|
|
246
247
|
UIView *iconView = markerView.iconView;
|
|
247
248
|
[iconView removeFromSuperview];
|
|
@@ -283,6 +284,7 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
283
284
|
marker.groundAnchor = markerView.anchor;
|
|
284
285
|
}
|
|
285
286
|
|
|
287
|
+
marker.zIndex = (int)markerView.zIndex;
|
|
286
288
|
marker.map = _mapView;
|
|
287
289
|
|
|
288
290
|
markerView.marker = marker;
|
package/ios/LuggMarkerView.h
CHANGED
|
@@ -14,10 +14,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
14
14
|
|
|
15
15
|
@interface LuggMarkerView : RCTViewComponentView
|
|
16
16
|
|
|
17
|
+
@property(nonatomic, readonly, nullable) NSString *name;
|
|
17
18
|
@property(nonatomic, readonly) CLLocationCoordinate2D coordinate;
|
|
18
19
|
@property(nonatomic, readonly, nullable) NSString *title;
|
|
19
20
|
@property(nonatomic, readonly, nullable) NSString *markerDescription;
|
|
20
21
|
@property(nonatomic, readonly) CGPoint anchor;
|
|
22
|
+
@property(nonatomic, readonly) NSInteger zIndex;
|
|
21
23
|
@property(nonatomic, readonly) BOOL hasCustomView;
|
|
22
24
|
@property(nonatomic, readonly) BOOL didLayout;
|
|
23
25
|
@property(nonatomic, readonly) UIView *iconView;
|
package/ios/LuggMarkerView.mm
CHANGED
|
@@ -13,10 +13,12 @@ using namespace facebook::react;
|
|
|
13
13
|
@end
|
|
14
14
|
|
|
15
15
|
@implementation LuggMarkerView {
|
|
16
|
+
NSString *_name;
|
|
16
17
|
CLLocationCoordinate2D _coordinate;
|
|
17
18
|
NSString *_title;
|
|
18
19
|
NSString *_markerDescription;
|
|
19
20
|
CGPoint _anchor;
|
|
21
|
+
NSInteger _zIndex;
|
|
20
22
|
BOOL _didLayout;
|
|
21
23
|
UIView *_iconView;
|
|
22
24
|
}
|
|
@@ -34,6 +36,7 @@ using namespace facebook::react;
|
|
|
34
36
|
|
|
35
37
|
_coordinate = CLLocationCoordinate2DMake(0, 0);
|
|
36
38
|
_anchor = CGPointMake(0.5, 1.0);
|
|
39
|
+
_zIndex = 0;
|
|
37
40
|
_didLayout = NO;
|
|
38
41
|
|
|
39
42
|
_iconView = [[UIView alloc] init];
|
|
@@ -52,12 +55,14 @@ using namespace facebook::react;
|
|
|
52
55
|
const auto &newViewProps =
|
|
53
56
|
*std::static_pointer_cast<LuggMarkerViewProps const>(props);
|
|
54
57
|
|
|
58
|
+
_name = [NSString stringWithUTF8String:newViewProps.name.c_str()];
|
|
55
59
|
_coordinate = CLLocationCoordinate2DMake(newViewProps.coordinate.latitude,
|
|
56
60
|
newViewProps.coordinate.longitude);
|
|
57
61
|
_title = [NSString stringWithUTF8String:newViewProps.title.c_str()];
|
|
58
62
|
_markerDescription =
|
|
59
63
|
[NSString stringWithUTF8String:newViewProps.description.c_str()];
|
|
60
64
|
_anchor = CGPointMake(newViewProps.anchor.x, newViewProps.anchor.y);
|
|
65
|
+
_zIndex = newViewProps.zIndex.value_or(0);
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask {
|
|
@@ -109,6 +114,10 @@ using namespace facebook::react;
|
|
|
109
114
|
}
|
|
110
115
|
}
|
|
111
116
|
|
|
117
|
+
- (NSString *)name {
|
|
118
|
+
return _name;
|
|
119
|
+
}
|
|
120
|
+
|
|
112
121
|
- (CLLocationCoordinate2D)coordinate {
|
|
113
122
|
return _coordinate;
|
|
114
123
|
}
|
|
@@ -125,6 +134,10 @@ using namespace facebook::react;
|
|
|
125
134
|
return _anchor;
|
|
126
135
|
}
|
|
127
136
|
|
|
137
|
+
- (NSInteger)zIndex {
|
|
138
|
+
return _zIndex;
|
|
139
|
+
}
|
|
140
|
+
|
|
128
141
|
- (BOOL)hasCustomView {
|
|
129
142
|
return _iconView.subviews.count > 0;
|
|
130
143
|
}
|
|
@@ -12,10 +12,13 @@ export class Marker extends React.Component {
|
|
|
12
12
|
title,
|
|
13
13
|
description,
|
|
14
14
|
anchor,
|
|
15
|
+
zIndex,
|
|
15
16
|
children
|
|
16
17
|
} = this.props;
|
|
17
18
|
return /*#__PURE__*/_jsx(LuggMarkerViewNativeComponent, {
|
|
18
|
-
style:
|
|
19
|
+
style: [{
|
|
20
|
+
zIndex
|
|
21
|
+
}, styles.marker],
|
|
19
22
|
name: name,
|
|
20
23
|
coordinate: coordinate,
|
|
21
24
|
title: title,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","LuggMarkerViewNativeComponent","jsx","_jsx","Marker","Component","render","name","coordinate","title","description","anchor","children","props","style","styles","marker","create","position","pointerEvents"],"sourceRoot":"../../../src","sources":["components/Marker.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,UAAU,QAAQ,cAAc;AACzC,OAAOC,6BAA6B,MAAM,yCAAyC;AAAC,SAAAC,GAAA,IAAAC,IAAA;
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","LuggMarkerViewNativeComponent","jsx","_jsx","Marker","Component","render","name","coordinate","title","description","anchor","zIndex","children","props","style","styles","marker","create","position","pointerEvents"],"sourceRoot":"../../../src","sources":["components/Marker.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO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AM,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,qBAAa,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;IACtD,MAAM;CAiBP"}
|
|
1
|
+
{"version":3,"file":"Marker.d.ts","sourceRoot":"","sources":["../../../../src/components/Marker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,qBAAa,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;IACtD,MAAM;CAiBP"}
|
package/package.json
CHANGED
|
@@ -25,6 +25,10 @@ export interface MarkerProps {
|
|
|
25
25
|
* Anchor point for custom marker views
|
|
26
26
|
*/
|
|
27
27
|
anchor?: Point;
|
|
28
|
+
/**
|
|
29
|
+
* Z-index for marker ordering. Higher values render on top.
|
|
30
|
+
*/
|
|
31
|
+
zIndex?: number;
|
|
28
32
|
/**
|
|
29
33
|
* Custom marker view
|
|
30
34
|
*/
|
|
@@ -33,12 +37,12 @@ export interface MarkerProps {
|
|
|
33
37
|
|
|
34
38
|
export class Marker extends React.Component<MarkerProps> {
|
|
35
39
|
render() {
|
|
36
|
-
const { name, coordinate, title, description, anchor, children } =
|
|
40
|
+
const { name, coordinate, title, description, anchor, zIndex, children } =
|
|
37
41
|
this.props;
|
|
38
42
|
|
|
39
43
|
return (
|
|
40
44
|
<LuggMarkerViewNativeComponent
|
|
41
|
-
style={styles.marker}
|
|
45
|
+
style={[{ zIndex }, styles.marker]}
|
|
42
46
|
name={name}
|
|
43
47
|
coordinate={coordinate}
|
|
44
48
|
title={title}
|