mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-12 23:28:25 +00:00
Code cleaning and fixes based on code review.
This commit is contained in:
parent
83d610cd54
commit
69ca67b578
@ -24,7 +24,6 @@
|
|||||||
MKMapSnapshotter *_snapshotter;
|
MKMapSnapshotter *_snapshotter;
|
||||||
BOOL _snapshotAfterLayout;
|
BOOL _snapshotAfterLayout;
|
||||||
NSArray *_annotations;
|
NSArray *_annotations;
|
||||||
// CLLocationCoordinate2D _centerCoordinateOfMap;
|
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -46,7 +45,6 @@
|
|||||||
|
|
||||||
_needsMapReloadOnBoundsChange = YES;
|
_needsMapReloadOnBoundsChange = YES;
|
||||||
_liveMap = NO;
|
_liveMap = NO;
|
||||||
// _centerCoordinateOfMap = kCLLocationCoordinate2DInvalid;
|
|
||||||
_annotations = @[];
|
_annotations = @[];
|
||||||
_showAnnotationsOptions = ASMapNodeShowAnnotationsOptionsIgnored;
|
_showAnnotationsOptions = ASMapNodeShowAnnotationsOptionsIgnored;
|
||||||
return self;
|
return self;
|
||||||
@ -161,18 +159,9 @@
|
|||||||
|
|
||||||
- (void)setRegion:(MKCoordinateRegion)region
|
- (void)setRegion:(MKCoordinateRegion)region
|
||||||
{
|
{
|
||||||
MKMapSnapshotOptions * __weak oldOptions = self.options;
|
MKMapSnapshotOptions * options = [self.options copy];
|
||||||
MKMapSnapshotOptions * options = [[MKMapSnapshotOptions alloc] init];
|
|
||||||
options.camera = oldOptions.camera;
|
|
||||||
options.mapRect = oldOptions.mapRect;
|
|
||||||
options.mapType = oldOptions.mapType;
|
|
||||||
options.showsPointsOfInterest = oldOptions.showsPointsOfInterest;
|
|
||||||
options.showsBuildings = oldOptions.showsBuildings;
|
|
||||||
options.size = oldOptions.size;
|
|
||||||
options.scale = oldOptions.scale;
|
|
||||||
options.region = region;
|
options.region = region;
|
||||||
self.options = options;
|
self.options = options;
|
||||||
// self.options.region = region;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Snapshotter
|
#pragma mark - Snapshotter
|
||||||
@ -282,18 +271,12 @@
|
|||||||
BOOL const animated = self.showAnnotationsOptions & ASMapNodeShowAnnotationsOptionsAnimated;
|
BOOL const animated = self.showAnnotationsOptions & ASMapNodeShowAnnotationsOptionsAnimated;
|
||||||
[_mapView showAnnotations:_mapView.annotations animated:animated];
|
[_mapView showAnnotations:_mapView.annotations animated:animated];
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (CLLocationCoordinate2DIsValid(_centerCoordinateOfMap)) {
|
|
||||||
// [_mapView setCenterCoordinate:_centerCoordinateOfMap];
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)removeLiveMap
|
- (void)removeLiveMap
|
||||||
{
|
{
|
||||||
self.userInteractionEnabled = false;
|
self.userInteractionEnabled = NO;
|
||||||
// FIXME: With MKCoordinateRegion, isn't the center coordinate fully specified? Do we need this?
|
|
||||||
// _centerCoordinateOfMap = _mapView.centerCoordinate;
|
|
||||||
[_mapView removeFromSuperview];
|
[_mapView removeFromSuperview];
|
||||||
_mapView = nil;
|
_mapView = nil;
|
||||||
}
|
}
|
||||||
@ -336,7 +319,7 @@
|
|||||||
CLLocationCoordinate2D topLeftCoord = CLLocationCoordinate2DMake(-90, 180);
|
CLLocationCoordinate2D topLeftCoord = CLLocationCoordinate2DMake(-90, 180);
|
||||||
CLLocationCoordinate2D bottomRightCoord = CLLocationCoordinate2DMake(90, -180);
|
CLLocationCoordinate2D bottomRightCoord = CLLocationCoordinate2DMake(90, -180);
|
||||||
|
|
||||||
for (id<MKAnnotation> annotation in _annotations) {
|
for (id<MKAnnotation> annotation in annotations) {
|
||||||
topLeftCoord = CLLocationCoordinate2DMake(fmax(topLeftCoord.latitude, annotation.coordinate.latitude),
|
topLeftCoord = CLLocationCoordinate2DMake(fmax(topLeftCoord.latitude, annotation.coordinate.latitude),
|
||||||
fmin(topLeftCoord.longitude, annotation.coordinate.longitude));
|
fmin(topLeftCoord.longitude, annotation.coordinate.longitude));
|
||||||
bottomRightCoord = CLLocationCoordinate2DMake(fmin(bottomRightCoord.latitude, annotation.coordinate.latitude),
|
bottomRightCoord = CLLocationCoordinate2DMake(fmin(bottomRightCoord.latitude, annotation.coordinate.latitude),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user