react-native-google-maps-plus 1.3.0-dev.2 → 1.3.0-dev.3
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/rngooglemapsplus/GoogleMapsViewImpl.kt +86 -5
- package/android/src/main/java/com/rngooglemapsplus/LocationHandler.kt +0 -1
- package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +38 -4
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNLatLngBoundsExtension.kt +17 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNSize.kt +7 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNSnapshotFormat.kt +16 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNSnapshotResultType.kt +9 -0
- package/ios/GoogleMapViewImpl.swift +261 -131
- package/ios/RNGoogleMapsPlusView.swift +72 -27
- package/ios/extensions/RNLatLngBounds+Extension.swift +16 -0
- package/ios/extensions/RNSize+Extension.swift +7 -0
- package/ios/extensions/RNSnapshotFormat+Extension.swift +28 -0
- package/ios/extensions/RNSnapshotResultType+Extension.swift +12 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts +6 -3
- package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +13 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.cpp +51 -7
- package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.hpp +5 -2
- package/nitrogen/generated/android/c++/JRNLatLngBounds.hpp +58 -0
- package/nitrogen/generated/android/c++/JRNSize.hpp +57 -0
- package/nitrogen/generated/android/c++/JRNSnapshotFormat.hpp +62 -0
- package/nitrogen/generated/android/c++/JRNSnapshotOptions.hpp +71 -0
- package/nitrogen/generated/android/c++/JRNSnapshotResultType.hpp +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/HybridRNGoogleMapsPlusViewSpec.kt +14 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNLatLngBounds.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNSize.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNSnapshotFormat.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNSnapshotOptions.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNSnapshotResultType.kt +21 -0
- package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.hpp +57 -0
- package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Umbrella.hpp +15 -0
- package/nitrogen/generated/ios/c++/HybridRNGoogleMapsPlusViewSpecSwift.hpp +40 -5
- package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec.swift +5 -2
- package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec_cxx.swift +58 -4
- package/nitrogen/generated/ios/swift/RNLatLngBounds.swift +46 -0
- package/nitrogen/generated/ios/swift/RNSize.swift +46 -0
- package/nitrogen/generated/ios/swift/RNSnapshotFormat.swift +44 -0
- package/nitrogen/generated/ios/swift/RNSnapshotOptions.swift +87 -0
- package/nitrogen/generated/ios/swift/RNSnapshotResultType.swift +40 -0
- package/nitrogen/generated/shared/c++/HybridRNGoogleMapsPlusViewSpec.cpp +3 -0
- package/nitrogen/generated/shared/c++/HybridRNGoogleMapsPlusViewSpec.hpp +12 -3
- package/nitrogen/generated/shared/c++/RNLatLngBounds.hpp +72 -0
- package/nitrogen/generated/shared/c++/RNSize.hpp +71 -0
- package/nitrogen/generated/shared/c++/RNSnapshotFormat.hpp +80 -0
- package/nitrogen/generated/shared/c++/RNSnapshotOptions.hpp +87 -0
- package/nitrogen/generated/shared/c++/RNSnapshotResultType.hpp +76 -0
- package/package.json +1 -1
- package/src/RNGoogleMapsPlusView.nitro.ts +15 -2
- package/src/types.ts +24 -2
|
@@ -41,6 +41,7 @@ GMSIndoorDisplayDelegate {
|
|
|
41
41
|
setupAppLifecycleObservers()
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
@MainActor
|
|
44
45
|
private func setupAppLifecycleObservers() {
|
|
45
46
|
NotificationCenter.default.addObserver(
|
|
46
47
|
self,
|
|
@@ -82,6 +83,7 @@ GMSIndoorDisplayDelegate {
|
|
|
82
83
|
mapReady = true
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
@MainActor
|
|
85
87
|
private func initLocationCallbacks() {
|
|
86
88
|
locationHandler.onUpdate = { [weak self] loc in
|
|
87
89
|
guard let self = self else { return }
|
|
@@ -191,6 +193,7 @@ GMSIndoorDisplayDelegate {
|
|
|
191
193
|
}
|
|
192
194
|
}
|
|
193
195
|
|
|
196
|
+
@MainActor
|
|
194
197
|
var currentCamera: GMSCameraPosition? {
|
|
195
198
|
mapView?.camera
|
|
196
199
|
}
|
|
@@ -268,7 +271,8 @@ GMSIndoorDisplayDelegate {
|
|
|
268
271
|
}
|
|
269
272
|
}
|
|
270
273
|
|
|
271
|
-
@MainActor
|
|
274
|
+
@MainActor
|
|
275
|
+
var mapPadding: RNMapPadding? {
|
|
272
276
|
didSet {
|
|
273
277
|
mapView?.padding =
|
|
274
278
|
mapPadding.map {
|
|
@@ -282,13 +286,15 @@ GMSIndoorDisplayDelegate {
|
|
|
282
286
|
}
|
|
283
287
|
}
|
|
284
288
|
|
|
285
|
-
@MainActor
|
|
289
|
+
@MainActor
|
|
290
|
+
var mapType: GMSMapViewType? {
|
|
286
291
|
didSet {
|
|
287
292
|
mapView?.mapType = mapType ?? .normal
|
|
288
293
|
}
|
|
289
294
|
}
|
|
290
295
|
|
|
291
|
-
@MainActor
|
|
296
|
+
@MainActor
|
|
297
|
+
var locationConfig: RNLocationConfig? {
|
|
292
298
|
didSet {
|
|
293
299
|
locationHandler.desiredAccuracy =
|
|
294
300
|
locationConfig?.ios?.desiredAccuracy?.toCLLocationAccuracy
|
|
@@ -315,11 +321,12 @@ GMSIndoorDisplayDelegate {
|
|
|
315
321
|
var onCameraChange: ((RNRegion, RNCamera, Bool) -> Void)?
|
|
316
322
|
var onCameraChangeComplete: ((RNRegion, RNCamera, Bool) -> Void)?
|
|
317
323
|
|
|
318
|
-
|
|
324
|
+
@MainActor
|
|
325
|
+
func setCamera(camera: GMSCameraPosition, animated: Bool, durationMs: Double) {
|
|
319
326
|
if animated {
|
|
320
327
|
withCATransaction(
|
|
321
328
|
disableActions: false,
|
|
322
|
-
duration:
|
|
329
|
+
duration: durationMs / 1000.0
|
|
323
330
|
) {
|
|
324
331
|
mapView?.animate(to: camera)
|
|
325
332
|
}
|
|
@@ -329,11 +336,12 @@ GMSIndoorDisplayDelegate {
|
|
|
329
336
|
}
|
|
330
337
|
}
|
|
331
338
|
|
|
339
|
+
@MainActor
|
|
332
340
|
func setCameraToCoordinates(
|
|
333
341
|
coordinates: [RNLatLng],
|
|
334
342
|
padding: RNMapPadding,
|
|
335
343
|
animated: Bool,
|
|
336
|
-
|
|
344
|
+
durationMs: Double
|
|
337
345
|
) {
|
|
338
346
|
if coordinates.isEmpty {
|
|
339
347
|
return
|
|
@@ -369,7 +377,7 @@ GMSIndoorDisplayDelegate {
|
|
|
369
377
|
if animated {
|
|
370
378
|
withCATransaction(
|
|
371
379
|
disableActions: false,
|
|
372
|
-
duration:
|
|
380
|
+
duration: durationMs / 1000.0
|
|
373
381
|
) {
|
|
374
382
|
mapView?.animate(with: update)
|
|
375
383
|
}
|
|
@@ -378,6 +386,90 @@ GMSIndoorDisplayDelegate {
|
|
|
378
386
|
}
|
|
379
387
|
}
|
|
380
388
|
|
|
389
|
+
@MainActor
|
|
390
|
+
func setCameraBounds(_ bounds: GMSCoordinateBounds?) {
|
|
391
|
+
mapView?.cameraTargetBounds = bounds
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
@MainActor
|
|
395
|
+
func animateToBounds(
|
|
396
|
+
_ bounds: GMSCoordinateBounds,
|
|
397
|
+
padding: Double,
|
|
398
|
+
durationMs: Double,
|
|
399
|
+
lockBounds: Bool
|
|
400
|
+
) {
|
|
401
|
+
if lockBounds {
|
|
402
|
+
mapView?.cameraTargetBounds = bounds
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
let update = GMSCameraUpdate.fit(bounds, withPadding: CGFloat(padding))
|
|
406
|
+
mapView?.animate(with: update)
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
@MainActor
|
|
410
|
+
func snapshot(
|
|
411
|
+
size: CGSize?,
|
|
412
|
+
format: String,
|
|
413
|
+
imageFormat: ImageFormat,
|
|
414
|
+
quality: CGFloat,
|
|
415
|
+
resultIsFile: Bool
|
|
416
|
+
) -> NitroModules.Promise<String?> {
|
|
417
|
+
let promise = Promise<String?>()
|
|
418
|
+
|
|
419
|
+
DispatchQueue.main.async {
|
|
420
|
+
guard let mapView = self.mapView else {
|
|
421
|
+
promise.resolve(withResult: nil)
|
|
422
|
+
return
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
let renderer = UIGraphicsImageRenderer(bounds: mapView.bounds)
|
|
426
|
+
let image = renderer.image { ctx in
|
|
427
|
+
mapView.layer.render(in: ctx.cgContext)
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
var finalImage = image
|
|
431
|
+
|
|
432
|
+
size.map {
|
|
433
|
+
UIGraphicsBeginImageContextWithOptions($0, false, 0.0)
|
|
434
|
+
image.draw(in: CGRect(origin: .zero, size: $0))
|
|
435
|
+
finalImage = UIGraphicsGetImageFromCurrentImageContext() ?? image
|
|
436
|
+
UIGraphicsEndImageContext()
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
let data: Data?
|
|
440
|
+
switch imageFormat {
|
|
441
|
+
case .jpeg:
|
|
442
|
+
data = finalImage.jpegData(compressionQuality: quality)
|
|
443
|
+
case .png:
|
|
444
|
+
data = finalImage.pngData()
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
guard let imageData = data else {
|
|
448
|
+
promise.resolve(withResult: nil)
|
|
449
|
+
return
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// Rückgabe
|
|
453
|
+
if resultIsFile {
|
|
454
|
+
let filename =
|
|
455
|
+
"map_snapshot_\(Int(Date().timeIntervalSince1970)).\(format)"
|
|
456
|
+
let fileURL = URL(fileURLWithPath: NSTemporaryDirectory())
|
|
457
|
+
.appendingPathComponent(filename)
|
|
458
|
+
do {
|
|
459
|
+
try imageData.write(to: fileURL)
|
|
460
|
+
promise.resolve(withResult: fileURL.path)
|
|
461
|
+
} catch {
|
|
462
|
+
promise.resolve(withResult: nil)
|
|
463
|
+
}
|
|
464
|
+
} else {
|
|
465
|
+
let base64 = imageData.base64EncodedString()
|
|
466
|
+
promise.resolve(withResult: "data:image/\(format);base64,\(base64)")
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
return promise
|
|
471
|
+
}
|
|
472
|
+
|
|
381
473
|
@MainActor
|
|
382
474
|
func addMarker(id: String, marker: GMSMarker) {
|
|
383
475
|
if mapView == nil {
|
|
@@ -619,177 +711,215 @@ GMSIndoorDisplayDelegate {
|
|
|
619
711
|
}
|
|
620
712
|
|
|
621
713
|
func mapView(_ mapView: GMSMapView, willMove gesture: Bool) {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
714
|
+
onMain {
|
|
715
|
+
let visibleRegion = mapView.projection.visibleRegion()
|
|
716
|
+
let bounds = GMSCoordinateBounds(region: visibleRegion)
|
|
717
|
+
|
|
718
|
+
let center = CLLocationCoordinate2D(
|
|
719
|
+
latitude: (bounds.northEast.latitude + bounds.southWest.latitude) / 2.0,
|
|
720
|
+
longitude: (bounds.northEast.longitude + bounds.southWest.longitude)
|
|
721
|
+
/ 2.0
|
|
722
|
+
)
|
|
629
723
|
|
|
630
|
-
|
|
631
|
-
|
|
724
|
+
let latDelta = bounds.northEast.latitude - bounds.southWest.latitude
|
|
725
|
+
let lngDelta = bounds.northEast.longitude - bounds.southWest.longitude
|
|
632
726
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
727
|
+
let cp = mapView.camera
|
|
728
|
+
let region = RNRegion(
|
|
729
|
+
center: RNLatLng(center.latitude, center.longitude),
|
|
730
|
+
latitudeDelta: latDelta,
|
|
731
|
+
longitudeDelta: lngDelta
|
|
732
|
+
)
|
|
733
|
+
let cam = RNCamera(
|
|
734
|
+
center: RNLatLng(
|
|
735
|
+
latitude: cp.target.latitude,
|
|
736
|
+
longitude: cp.target.longitude
|
|
737
|
+
),
|
|
738
|
+
zoom: Double(cp.zoom),
|
|
739
|
+
bearing: cp.bearing,
|
|
740
|
+
tilt: cp.viewingAngle
|
|
741
|
+
)
|
|
742
|
+
self.cameraMoveReasonIsGesture = gesture
|
|
649
743
|
|
|
650
|
-
|
|
744
|
+
self.onCameraChangeStart?(region, cam, gesture)
|
|
745
|
+
}
|
|
651
746
|
}
|
|
652
747
|
|
|
653
748
|
func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition) {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
let bounds = GMSCoordinateBounds(region: visibleRegion)
|
|
749
|
+
onMain {
|
|
750
|
+
if let last = self.lastSubmittedCameraPosition,
|
|
751
|
+
last.target.latitude == position.target.latitude,
|
|
752
|
+
last.target.longitude == position.target.longitude,
|
|
753
|
+
last.zoom == position.zoom,
|
|
754
|
+
last.bearing == position.bearing,
|
|
755
|
+
last.viewingAngle == position.viewingAngle {
|
|
756
|
+
return
|
|
757
|
+
}
|
|
664
758
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
)
|
|
759
|
+
self.lastSubmittedCameraPosition = position
|
|
760
|
+
let visibleRegion = mapView.projection.visibleRegion()
|
|
761
|
+
let bounds = GMSCoordinateBounds(region: visibleRegion)
|
|
669
762
|
|
|
670
|
-
|
|
671
|
-
|
|
763
|
+
let center = CLLocationCoordinate2D(
|
|
764
|
+
latitude: (bounds.northEast.latitude + bounds.southWest.latitude) / 2.0,
|
|
765
|
+
longitude: (bounds.northEast.longitude + bounds.southWest.longitude)
|
|
766
|
+
/ 2.0
|
|
767
|
+
)
|
|
672
768
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
769
|
+
let latDelta = bounds.northEast.latitude - bounds.southWest.latitude
|
|
770
|
+
let lngDelta = bounds.northEast.longitude - bounds.southWest.longitude
|
|
771
|
+
|
|
772
|
+
let cp = mapView.camera
|
|
773
|
+
let region = RNRegion(
|
|
774
|
+
center: RNLatLng(center.latitude, center.longitude),
|
|
775
|
+
latitudeDelta: latDelta,
|
|
776
|
+
longitudeDelta: lngDelta
|
|
777
|
+
)
|
|
778
|
+
let cam = RNCamera(
|
|
779
|
+
center: RNLatLng(
|
|
780
|
+
latitude: cp.target.latitude,
|
|
781
|
+
longitude: cp.target.longitude
|
|
782
|
+
),
|
|
783
|
+
zoom: Double(cp.zoom),
|
|
784
|
+
bearing: cp.bearing,
|
|
785
|
+
tilt: cp.viewingAngle
|
|
786
|
+
)
|
|
787
|
+
self.onCameraChange?(region, cam, self.cameraMoveReasonIsGesture)
|
|
788
|
+
}
|
|
690
789
|
}
|
|
691
790
|
|
|
692
791
|
func mapView(_ mapView: GMSMapView, idleAt position: GMSCameraPosition) {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
792
|
+
onMain {
|
|
793
|
+
let visibleRegion = mapView.projection.visibleRegion()
|
|
794
|
+
let bounds = GMSCoordinateBounds(region: visibleRegion)
|
|
795
|
+
|
|
796
|
+
let center = CLLocationCoordinate2D(
|
|
797
|
+
latitude: (bounds.northEast.latitude + bounds.southWest.latitude) / 2.0,
|
|
798
|
+
longitude: (bounds.northEast.longitude + bounds.southWest.longitude)
|
|
799
|
+
/ 2.0
|
|
800
|
+
)
|
|
700
801
|
|
|
701
|
-
|
|
702
|
-
|
|
802
|
+
let latDelta = bounds.northEast.latitude - bounds.southWest.latitude
|
|
803
|
+
let lngDelta = bounds.northEast.longitude - bounds.southWest.longitude
|
|
703
804
|
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
805
|
+
let cp = mapView.camera
|
|
806
|
+
let region = RNRegion(
|
|
807
|
+
center: RNLatLng(center.latitude, center.longitude),
|
|
808
|
+
latitudeDelta: latDelta,
|
|
809
|
+
longitudeDelta: lngDelta
|
|
810
|
+
)
|
|
811
|
+
let cam = RNCamera(
|
|
812
|
+
center: RNLatLng(
|
|
813
|
+
latitude: cp.target.latitude,
|
|
814
|
+
longitude: cp.target.longitude
|
|
815
|
+
),
|
|
816
|
+
zoom: Double(cp.zoom),
|
|
817
|
+
bearing: cp.bearing,
|
|
818
|
+
tilt: cp.viewingAngle
|
|
819
|
+
)
|
|
820
|
+
self.onCameraChangeComplete?(region, cam, self.cameraMoveReasonIsGesture)
|
|
821
|
+
}
|
|
720
822
|
}
|
|
721
823
|
|
|
722
824
|
func mapView(
|
|
723
825
|
_ mapView: GMSMapView,
|
|
724
826
|
didTapAt coordinate: CLLocationCoordinate2D
|
|
725
827
|
) {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
828
|
+
onMain {
|
|
829
|
+
self.onMapPress?(
|
|
830
|
+
RNLatLng(
|
|
831
|
+
latitude: coordinate.latitude,
|
|
832
|
+
longitude: coordinate.longitude
|
|
833
|
+
)
|
|
730
834
|
)
|
|
731
|
-
|
|
835
|
+
}
|
|
732
836
|
}
|
|
733
837
|
|
|
734
838
|
func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
|
|
735
|
-
|
|
736
|
-
|
|
839
|
+
onMain {
|
|
840
|
+
mapView.selectedMarker = marker
|
|
841
|
+
self.onMarkerPress?(marker.userData as? String, )
|
|
842
|
+
}
|
|
737
843
|
return true
|
|
738
844
|
}
|
|
739
845
|
|
|
740
846
|
func mapView(_ mapView: GMSMapView, didTap overlay: GMSOverlay) {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
847
|
+
onMain {
|
|
848
|
+
switch overlay {
|
|
849
|
+
case let circle as GMSCircle:
|
|
850
|
+
self.onCirclePress?(circle.userData as? String, )
|
|
744
851
|
|
|
745
|
-
|
|
746
|
-
|
|
852
|
+
case let polygon as GMSPolygon:
|
|
853
|
+
self.onPolygonPress?(polygon.userData as? String, )
|
|
747
854
|
|
|
748
|
-
|
|
749
|
-
|
|
855
|
+
case let polyline as GMSPolyline:
|
|
856
|
+
self.onPolylinePress?(polyline.userData as? String, )
|
|
750
857
|
|
|
751
|
-
|
|
752
|
-
|
|
858
|
+
default:
|
|
859
|
+
break
|
|
860
|
+
}
|
|
753
861
|
}
|
|
754
862
|
}
|
|
755
863
|
|
|
756
864
|
func mapView(_ mapView: GMSMapView, didBeginDragging marker: GMSMarker) {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
865
|
+
onMain {
|
|
866
|
+
self.onMarkerDragStart?(
|
|
867
|
+
marker.userData as? String,
|
|
868
|
+
RNLatLng(marker.position.latitude, marker.position.longitude)
|
|
869
|
+
)
|
|
870
|
+
}
|
|
761
871
|
}
|
|
762
872
|
|
|
763
873
|
func mapView(_ mapView: GMSMapView, didDrag marker: GMSMarker) {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
874
|
+
onMain {
|
|
875
|
+
self.onMarkerDrag?(
|
|
876
|
+
marker.userData as? String,
|
|
877
|
+
RNLatLng(marker.position.latitude, marker.position.longitude)
|
|
878
|
+
)
|
|
879
|
+
}
|
|
768
880
|
}
|
|
769
881
|
|
|
770
882
|
func mapView(_ mapView: GMSMapView, didEndDragging marker: GMSMarker) {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
883
|
+
onMain {
|
|
884
|
+
self.onMarkerDragEnd?(
|
|
885
|
+
marker.userData as? String,
|
|
886
|
+
RNLatLng(marker.position.latitude, marker.position.longitude)
|
|
887
|
+
)
|
|
888
|
+
}
|
|
775
889
|
}
|
|
776
890
|
|
|
777
891
|
func didChangeActiveBuilding(_ building: GMSIndoorBuilding?) {
|
|
778
|
-
|
|
779
|
-
|
|
892
|
+
onMain {
|
|
893
|
+
guard let display = self.mapView?.indoorDisplay, let building else {
|
|
894
|
+
return
|
|
895
|
+
}
|
|
896
|
+
self.onIndoorBuildingFocused?(building.toRNIndoorBuilding(from: display))
|
|
897
|
+
}
|
|
780
898
|
}
|
|
781
899
|
|
|
782
900
|
func didChangeActiveLevel(_ level: GMSIndoorLevel?) {
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
901
|
+
onMain {
|
|
902
|
+
guard
|
|
903
|
+
let display = self.mapView?.indoorDisplay,
|
|
904
|
+
let building = display.activeBuilding,
|
|
905
|
+
let level,
|
|
906
|
+
let index = building.levels.firstIndex(where: {
|
|
907
|
+
$0.name == level.name && $0.shortName == level.shortName
|
|
908
|
+
})
|
|
909
|
+
else { return }
|
|
910
|
+
|
|
911
|
+
self.onIndoorLevelActivated?(
|
|
912
|
+
level.toRNIndoorLevel(index: index, active: true)
|
|
913
|
+
)
|
|
914
|
+
}
|
|
793
915
|
}
|
|
916
|
+
}
|
|
794
917
|
|
|
918
|
+
@inline(__always)
|
|
919
|
+
func onMain(_ block: @escaping () -> Void) {
|
|
920
|
+
if Thread.isMainThread {
|
|
921
|
+
block()
|
|
922
|
+
} else {
|
|
923
|
+
DispatchQueue.main.async { block() }
|
|
924
|
+
}
|
|
795
925
|
}
|