diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/macos/app/Base.lproj/MapDocument.xib | 1 | ||||
-rw-r--r-- | platform/macos/app/MapDocument.m | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/platform/macos/app/Base.lproj/MapDocument.xib b/platform/macos/app/Base.lproj/MapDocument.xib index 9af40d461d..e147ba83d0 100644 --- a/platform/macos/app/Base.lproj/MapDocument.xib +++ b/platform/macos/app/Base.lproj/MapDocument.xib @@ -26,6 +26,7 @@ <objectController objectClassName="MGLStyle" id="Xji-k6-iQ4" userLabel="Style Object Controller"> <declaredKeys> <string>layers</string> + <string>name</string> </declaredKeys> <connections> <binding destination="jxx-uM-ZTC" name="contentObject" keyPath="selection.style" id="60N-aU-tgJ"/> 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]; |