summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-12-05 21:18:05 -0800
committerMinh Nguyễn <mxn@1ec5.org>2015-12-13 17:26:53 -0800
commitcd6830b3ea6f751a1cabb46db7e3da6b658723a5 (patch)
treed30b9b063d5d79bbd9add764592b81abdbc29fd9 /platform
parentfdff7901e2480cd683317eec2e490fc704612a0b (diff)
downloadqtlocation-mapboxgl-cd6830b3ea6f751a1cabb46db7e3da6b658723a5.tar.gz
[osx] Fixed IB latitude/longitude inspectables
Diffstat (limited to 'platform')
-rw-r--r--platform/osx/sdk/Mapbox.m2
-rw-r--r--platform/osx/src/MGLMapView+IBAdditions.m2
-rw-r--r--platform/osx/src/MGLMapView.mm24
-rw-r--r--platform/osx/src/MGLMapView_Private.h2
4 files changed, 29 insertions, 1 deletions
diff --git a/platform/osx/sdk/Mapbox.m b/platform/osx/sdk/Mapbox.m
index 661795a87b..1ac5a2d81e 100644
--- a/platform/osx/sdk/Mapbox.m
+++ b/platform/osx/sdk/Mapbox.m
@@ -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];
diff --git a/platform/osx/src/MGLMapView+IBAdditions.m b/platform/osx/src/MGLMapView+IBAdditions.m
index d6c6b40cb6..aaa4ddf1bb 100644
--- a/platform/osx/src/MGLMapView+IBAdditions.m
+++ b/platform/osx/src/MGLMapView+IBAdditions.m
@@ -2,6 +2,8 @@
#import "MGLMapView_Private.h"
+void mgl_linkMapViewIBCategory() {}
+
@implementation MGLMapView (IBAdditions)
+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingStyleURL__ {
diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm
index 2796c5fdb5..83b9bf009b 100644
--- a/platform/osx/src/MGLMapView.mm
+++ b/platform/osx/src/MGLMapView.mm
@@ -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();
}
diff --git a/platform/osx/src/MGLMapView_Private.h b/platform/osx/src/MGLMapView_Private.h
index c206fffe69..d9d42c1b35 100644
--- a/platform/osx/src/MGLMapView_Private.h
+++ b/platform/osx/src/MGLMapView_Private.h
@@ -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