@lugg/maps 1.1.5 → 1.1.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.
|
@@ -533,6 +533,17 @@ MKMapType LuggMKMapTypeFromMapType(LuggMapViewMapType mapType) {
|
|
|
533
533
|
_edgeInsetsDisplayLink = nil;
|
|
534
534
|
}
|
|
535
535
|
|
|
536
|
+
// An inset animation re-centers the map on every frame, which stops a camera
|
|
537
|
+
// animation. A camera command moves the map anyway, so it takes the final
|
|
538
|
+
// insets without the re-center.
|
|
539
|
+
- (void)finishEdgeInsetsAnimation {
|
|
540
|
+
if (!_edgeInsetsDisplayLink)
|
|
541
|
+
return;
|
|
542
|
+
[self stopEdgeInsetsAnimation];
|
|
543
|
+
_mapView.layoutMargins = _edgeInsetsTo;
|
|
544
|
+
_edgeInsetsCurrent = _edgeInsetsTo;
|
|
545
|
+
}
|
|
546
|
+
|
|
536
547
|
- (CLLocationDistance)cameraDistanceForZoomLevel:(double)zoomLevel {
|
|
537
548
|
return 128000000.0 / pow(2, zoomLevel);
|
|
538
549
|
}
|
|
@@ -1785,6 +1796,7 @@ MKMapType LuggMKMapTypeFromMapType(LuggMapViewMapType mapType) {
|
|
|
1785
1796
|
if (!_mapView)
|
|
1786
1797
|
return;
|
|
1787
1798
|
|
|
1799
|
+
[self finishEdgeInsetsAnimation];
|
|
1788
1800
|
double targetZoom = zoom > 0 ? zoom : _mapView.zoomLevel;
|
|
1789
1801
|
|
|
1790
1802
|
if (duration < 0) {
|
|
@@ -1837,6 +1849,7 @@ MKMapType LuggMKMapTypeFromMapType(LuggMapViewMapType mapType) {
|
|
|
1837
1849
|
UIEdgeInsets insets = UIEdgeInsetsMake(edgeInsetsTop, edgeInsetsLeft,
|
|
1838
1850
|
edgeInsetsBottom, edgeInsetsRight);
|
|
1839
1851
|
|
|
1852
|
+
[self finishEdgeInsetsAnimation];
|
|
1840
1853
|
if (duration < 0) {
|
|
1841
1854
|
[_mapView setVisibleMapRect:mapRect edgePadding:insets animated:YES];
|
|
1842
1855
|
} else if (duration > 0) {
|
|
@@ -1176,18 +1176,26 @@ LuggInterfaceStyleFromTheme(facebook::react::LuggMapViewTheme theme) {
|
|
|
1176
1176
|
|
|
1177
1177
|
UIEdgeInsets insets = UIEdgeInsetsMake(edgeInsetsTop, edgeInsetsLeft,
|
|
1178
1178
|
edgeInsetsBottom, edgeInsetsRight);
|
|
1179
|
-
|
|
1180
|
-
|
|
1179
|
+
|
|
1180
|
+
// An inset animation may still be moving the padding toward _edgeInsets.
|
|
1181
|
+
// Fit against the padding it ends at: the camera target stays centered in
|
|
1182
|
+
// the padding while the animation finishes.
|
|
1183
|
+
UIEdgeInsets padding = _mapView.padding;
|
|
1184
|
+
_mapView.padding = _edgeInsets;
|
|
1185
|
+
GMSCameraPosition *camera = [_mapView cameraForBounds:bounds insets:insets];
|
|
1186
|
+
_mapView.padding = padding;
|
|
1187
|
+
if (!camera)
|
|
1188
|
+
return;
|
|
1181
1189
|
|
|
1182
1190
|
if (duration < 0) {
|
|
1183
|
-
[_mapView
|
|
1191
|
+
[_mapView animateToCameraPosition:camera];
|
|
1184
1192
|
} else if (duration > 0) {
|
|
1185
1193
|
[CATransaction begin];
|
|
1186
1194
|
[CATransaction setAnimationDuration:duration / 1000.0];
|
|
1187
|
-
[_mapView
|
|
1195
|
+
[_mapView animateToCameraPosition:camera];
|
|
1188
1196
|
[CATransaction commit];
|
|
1189
1197
|
} else {
|
|
1190
|
-
[_mapView
|
|
1198
|
+
[_mapView setCamera:camera];
|
|
1191
1199
|
}
|
|
1192
1200
|
}
|
|
1193
1201
|
|