[osx] Fixed IB latitude/longitude inspectables

This commit is contained in:
Minh Nguyễn
2015-12-05 21:18:05 -08:00
committed by Minh Nguyễn
parent fdff7901e2
commit cd6830b3ea
4 changed files with 29 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
#import <Mapbox/Mapbox.h>
#import "../src/MGLMapView_Private.h"
#import "../src/NSBundle+MGLAdditions.h"
#import "../src/NSProcessInfo+MGLAdditions.h"
#import "../../darwin/NSString+MGLAdditions.h"
@@ -14,6 +15,7 @@ static void InitializeMapbox() {
mgl_linkBundleCategory();
mgl_linkStringCategory();
mgl_linkProcessInfoCategory();
mgl_linkMapViewIBCategory();
[MGLAccountManager class];
[MGLAnnotationImage class];

View File

@@ -2,6 +2,8 @@
#import "MGLMapView_Private.h"
void mgl_linkMapViewIBCategory() {}
@implementation MGLMapView (IBAdditions)
+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingStyleURL__ {

View File

@@ -209,7 +209,7 @@ public:
}
+ (NSArray *)restorableStateKeyPaths {
return @[@"zoomLevel", @"direction"];
return @[@"latitude", @"longitude", @"zoomLevel", @"direction"];
}
- (void)commonInit {
@@ -275,6 +275,8 @@ public:
options.center = mbgl::LatLng(0, 0);
options.zoom = _mbglMap->getMinZoom();
_mbglMap->jumpTo(options);
_pendingLatitude = NAN;
_pendingLongitude = NAN;
}
/// Adds zoom controls to the lower-right corner.
@@ -770,6 +772,10 @@ public:
#pragma mark Viewport
+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCenterCoordinate {
return [NSSet setWithObjects:@"latitude", @"longitude", nil];
}
- (CLLocationCoordinate2D)centerCoordinate {
return MGLLocationCoordinate2DFromLatLng(_mbglMap->getLatLng());
}
@@ -793,6 +799,22 @@ public:
[self didChangeValueForKey:@"centerCoordinate"];
}
- (CLLocationDegrees)pendingLatitude {
return _pendingLatitude;
}
- (void)setPendingLatitude:(CLLocationDegrees)pendingLatitude {
_pendingLatitude = pendingLatitude;
}
- (CLLocationDegrees)pendingLongitude {
return _pendingLongitude;
}
- (void)setPendingLongitude:(CLLocationDegrees)pendingLongitude {
_pendingLongitude = pendingLongitude;
}
- (double)zoomLevel {
return _mbglMap->getZoom();
}

View File

@@ -1,5 +1,7 @@
#import <mbgl/osx/MGLMapView.h>
void mgl_linkMapViewIBCategory();
@interface MGLMapView (Private)
/// True if the view or application is in a state where it is not expected to be