summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2017-02-11 02:39:19 -0500
committerJason Wray <friedbunny@users.noreply.github.com>2017-02-13 18:35:04 -0500
commit235a06795acd8a8c084a778b19119c643bc3c931 (patch)
tree272c1326e8f54dcff9c9fdbe193140af12a90afe
parent3ec93d3bbecb77863212a096ea3ca962197ab5fa (diff)
downloadqtlocation-mapboxgl-235a06795acd8a8c084a778b19119c643bc3c931.tar.gz
[ios] Add iosapp Show Zoom Level debug option
-rw-r--r--platform/ios/app/MBXViewController.m29
1 files changed, 24 insertions, 5 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 7df54ba65b..d82bc18f78 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -77,6 +77,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
MBXSettingsMiscellaneousShowReuseQueueStats = 0,
MBXSettingsMiscellaneousWorldTour,
MBXSettingsMiscellaneousCustomUserDot,
+ MBXSettingsMiscellaneousShowZoomLevel,
MBXSettingsMiscellaneousPrintLogFile,
MBXSettingsMiscellaneousDeleteLogFile,
};
@@ -113,6 +114,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
@property (nonatomic) BOOL customUserLocationAnnnotationEnabled;
@property (nonatomic) BOOL usingLocaleBasedCountryLabels;
@property (nonatomic) BOOL reuseQueueStatsEnabled;
+@property (nonatomic) BOOL showZoomLevelEnabled;
@end
@@ -153,6 +155,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
[self restoreState:nil];
self.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"MGLMapboxMetricsDebugLoggingEnabled"];
+
self.hudLabel.hidden = YES;
if ([MGLAccountManager accessToken].length)
@@ -339,11 +342,11 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
]];
break;
case MBXSettingsMiscellaneous:
- [settingsTitles addObject:@"Show Reuse Queue Stats"];
-
[settingsTitles addObjectsFromArray:@[
+ [NSString stringWithFormat:@"%@ Reuse Queue Stats", (_reuseQueueStatsEnabled ? @"Hide" :@"Show")],
@"Start World Tour",
[NSString stringWithFormat:@"%@ Custom User Dot", (_customUserLocationAnnnotationEnabled ? @"Disable" : @"Enable")],
+ [NSString stringWithFormat:@"%@ Zoom Level", (_showZoomLevelEnabled ? @"Hide" :@"Show")],
]];
if (self.debugLoggingEnabled)
@@ -522,8 +525,16 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
break;
case MBXSettingsMiscellaneousShowReuseQueueStats:
{
- self.reuseQueueStatsEnabled = YES;
- self.hudLabel.hidden = NO;
+ self.reuseQueueStatsEnabled = !self.reuseQueueStatsEnabled;
+ self.hudLabel.hidden = !self.reuseQueueStatsEnabled;
+ self.showZoomLevelEnabled = NO;
+ break;
+ }
+ case MBXSettingsMiscellaneousShowZoomLevel:
+ {
+ self.showZoomLevelEnabled = !self.showZoomLevelEnabled;
+ self.hudLabel.hidden = !self.showZoomLevelEnabled;
+ self.reuseQueueStatsEnabled = NO;
break;
}
default:
@@ -1711,7 +1722,15 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
{
queuedAnnotations += queue.count;
}
- self.hudLabel.text = [NSString stringWithFormat:@"Visible: %ld Queued: %ld", (unsigned long)mapView.visibleAnnotations.count, (unsigned long)queuedAnnotations];
+ self.hudLabel.text = [NSString stringWithFormat:@" Visible: %ld Queued: %ld", (unsigned long)mapView.visibleAnnotations.count, (unsigned long)queuedAnnotations];
+ } else if (self.showZoomLevelEnabled) {
+ self.hudLabel.text = [NSString stringWithFormat:@" Zoom: %.2f", self.mapView.zoomLevel];
+ }
+}
+
+- (void)mapView:(MGLMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
+ if (self.showZoomLevelEnabled) {
+ self.hudLabel.text = [NSString stringWithFormat:@" Zoom: %.2f", self.mapView.zoomLevel];
}
}