@rnmapbox/maps 10.1.0-rc.5 → 10.1.0-rc.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.
|
@@ -1398,6 +1398,12 @@ class RNMBXPointAnnotationManager : AnnotationInteractionDelegate {
|
|
|
1398
1398
|
return rnmbxPointAnnotation
|
|
1399
1399
|
}
|
|
1400
1400
|
}
|
|
1401
|
+
#if RNMBX_11
|
|
1402
|
+
// see https://github.com/rnmapbox/maps/issues/3121
|
|
1403
|
+
if let rnmbxPointAnnotation = annotations.object(forKey: annotation.id as NSString) {
|
|
1404
|
+
return rnmbxPointAnnotation;
|
|
1405
|
+
}
|
|
1406
|
+
#endif
|
|
1401
1407
|
return nil
|
|
1402
1408
|
}
|
|
1403
1409
|
|
|
@@ -1474,41 +1480,36 @@ class RNMBXPointAnnotationManager : AnnotationInteractionDelegate {
|
|
|
1474
1480
|
|
|
1475
1481
|
for annotation in annotations {
|
|
1476
1482
|
if let pointAnnotation = annotation as? PointAnnotation,
|
|
1477
|
-
let
|
|
1478
|
-
|
|
1479
|
-
if let RNMBXPointAnnotation = userInfo[RNMBXPointAnnotation.key] as? WeakRef<RNMBXPointAnnotation> {
|
|
1480
|
-
if let pt = RNMBXPointAnnotation.object {
|
|
1483
|
+
let pt = lookup(pointAnnotation) {
|
|
1481
1484
|
let position = pt.superview?.convert(pt.layer.position, to: nil)
|
|
1482
1485
|
var geojson = Feature(geometry: .point(Point(targetPoint)))
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
return
|
|
1493
|
-
}
|
|
1494
|
-
onDragStart(event.toJSON())
|
|
1495
|
-
case .changed:
|
|
1496
|
-
guard let onDrag = pt.onDrag else {
|
|
1497
|
-
return
|
|
1498
|
-
}
|
|
1499
|
-
onDrag(event.toJSON())
|
|
1486
|
+
geojson.identifier = .string(pt.id)
|
|
1487
|
+
geojson.properties = [
|
|
1488
|
+
"screenPointX": .number(Double(position!.x)),
|
|
1489
|
+
"screenPointY": .number(Double(position!.y))
|
|
1490
|
+
]
|
|
1491
|
+
let event = RNMBXEvent(type:.longPress, payload: logged("doHandleLongPress") { try geojson.toJSON() })
|
|
1492
|
+
switch (dragState) {
|
|
1493
|
+
case .began:
|
|
1494
|
+
guard let onDragStart = pt.onDragStart else {
|
|
1500
1495
|
return
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
onDragEnd(event.toJSON())
|
|
1496
|
+
}
|
|
1497
|
+
onDragStart(event.toJSON())
|
|
1498
|
+
case .changed:
|
|
1499
|
+
guard let onDrag = pt.onDrag else {
|
|
1506
1500
|
return
|
|
1507
|
-
|
|
1501
|
+
}
|
|
1502
|
+
onDrag(event.toJSON())
|
|
1503
|
+
return
|
|
1504
|
+
case .ended:
|
|
1505
|
+
guard let onDragEnd = pt.onDragEnd else {
|
|
1508
1506
|
return
|
|
1509
1507
|
}
|
|
1508
|
+
onDragEnd(event.toJSON())
|
|
1509
|
+
return
|
|
1510
|
+
default:
|
|
1511
|
+
return
|
|
1510
1512
|
}
|
|
1511
|
-
}
|
|
1512
1513
|
}
|
|
1513
1514
|
}
|
|
1514
1515
|
}
|
|
@@ -1543,7 +1544,7 @@ class RNMBXPointAnnotationManager : AnnotationInteractionDelegate {
|
|
|
1543
1544
|
|
|
1544
1545
|
// Find if any `queriedFeatureIds` match an annotation's `id`
|
|
1545
1546
|
let draggedAnnotations = self.manager.annotations.filter { queriedFeatureIds.contains($0.id) }
|
|
1546
|
-
let enabledAnnotations = draggedAnnotations.filter { ($0
|
|
1547
|
+
let enabledAnnotations = draggedAnnotations.filter { self.lookup($0)?.draggable ?? false }
|
|
1547
1548
|
// If `tappedAnnotations` is not empty, call delegate
|
|
1548
1549
|
if !enabledAnnotations.isEmpty {
|
|
1549
1550
|
self.draggedAnnotation = enabledAnnotations.first!
|
|
@@ -1586,9 +1587,19 @@ class RNMBXPointAnnotationManager : AnnotationInteractionDelegate {
|
|
|
1586
1587
|
manager.annotations.removeAll(where: {$0.id == annotation.id})
|
|
1587
1588
|
}
|
|
1588
1589
|
|
|
1589
|
-
|
|
1590
|
+
#if RNMBX_11
|
|
1591
|
+
var annotations = NSMapTable<NSString, RNMBXPointAnnotation>.init(
|
|
1592
|
+
keyOptions: .copyIn,
|
|
1593
|
+
valueOptions: .weakMemory
|
|
1594
|
+
)
|
|
1595
|
+
#endif
|
|
1596
|
+
|
|
1597
|
+
func add(_ annotation: PointAnnotation, _ rnmbxPointAnnotation: RNMBXPointAnnotation) {
|
|
1590
1598
|
manager.annotations.append(annotation)
|
|
1591
1599
|
manager.refresh()
|
|
1600
|
+
#if RNMBX_11
|
|
1601
|
+
annotations.setObject(rnmbxPointAnnotation, forKey: annotation.id as NSString)
|
|
1602
|
+
#endif
|
|
1592
1603
|
}
|
|
1593
1604
|
|
|
1594
1605
|
func update(_ annotation: PointAnnotation) {
|
|
@@ -285,7 +285,7 @@ extension RNMBXPointAnnotation {
|
|
|
285
285
|
&& annotation.point.coordinates.isValid()
|
|
286
286
|
&& (logged("PointAnnotation: missing id attribute") { return id }) != nil,
|
|
287
287
|
let pointAnnotationManager = map?.pointAnnotationManager {
|
|
288
|
-
pointAnnotationManager.add(annotation)
|
|
288
|
+
pointAnnotationManager.add(annotation, self)
|
|
289
289
|
added = true
|
|
290
290
|
return true
|
|
291
291
|
}
|