diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-11-25 17:25:31 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-11-28 15:45:44 -0800 |
commit | f6113559126b5e5fa90c4f8c31ef589058998def (patch) | |
tree | 89e85bdc328f15735e76712e1146a52ba060d224 /platform/macos/app/MapDocument.m | |
parent | 992726ab492bad5bddd49a5a5c3e57764f1998b9 (diff) | |
download | qtlocation-mapboxgl-f6113559126b5e5fa90c4f8c31ef589058998def.tar.gz |
[macos] Name custom style in toolbar
Display the custom style’s name in the Style toolbar button.
Diffstat (limited to 'platform/macos/app/MapDocument.m')
-rw-r--r-- | platform/macos/app/MapDocument.m | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index e312eccca2..c05a85f960 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -865,10 +865,13 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio NSPopUpButton *popUpButton = (NSPopUpButton *)toolbarItem.view; NSUInteger index = self.indexOfStyleInToolbarItem; if (index == NSNotFound) { - [popUpButton addItemWithTitle:@"Custom"]; - index = [popUpButton numberOfItems] - 1; + index = -1; } [popUpButton selectItemAtIndex:index]; + if (index == -1) { + NSString *name = self.mapView.style.name; + popUpButton.title = name ?: @"Custom"; + } } if (action == @selector(toggleLayers:)) { BOOL isShown = ![self.splitView isSubviewCollapsed:self.splitView.arrangedSubviews.firstObject]; |