Show zoom level in window's title bar

This commit is contained in:
Eimantas Vaiciunas
2017-04-02 14:35:24 +03:00
committed by Minh Nguyễn
parent b5b4549b6d
commit 4a4b6a8af3
2 changed files with 15 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12118" systemVersion="16E195" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12118"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -48,7 +48,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="388" y="211" width="642" height="480"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
<view key="contentView" id="TuG-C5-zLS">
<rect key="frame" x="0.0" y="0.0" width="642" height="480"/>
<autoresizingMask key="autoresizingMask"/>
@@ -240,12 +240,17 @@
</connections>
</toolbar>
<connections>
<binding destination="-2" name="displayPatternTitle1" keyPath="mapView.centerCoordinate" id="wtz-AV-bG1">
<binding destination="-2" name="displayPatternTitle1" keyPath="mapView.centerCoordinate" id="p1k-yo-4Nb">
<dictionary key="options">
<string key="NSDisplayPattern">%{title1}@</string>
<string key="NSDisplayPattern">%{title1}@ @ %{title2}@</string>
<string key="NSValueTransformerName">LocationCoordinate2DTransformer</string>
</dictionary>
</binding>
<binding destination="-2" name="displayPatternTitle2" keyPath="mapView.zoomLevel" previousBinding="p1k-yo-4Nb" id="HBB-y3-89c">
<dictionary key="options">
<string key="NSDisplayPattern">%{title1}@ @ %{title2}@</string>
</dictionary>
</binding>
<outlet property="delegate" destination="-2" id="HEo-Qf-o6o"/>
</connections>
</window>

View File

@@ -156,7 +156,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
#pragma mark View methods
- (IBAction)showStyle:(id)sender {
NSInteger tag;
NSInteger tag = -1;
if ([sender isKindOfClass:[NSMenuItem class]]) {
tag = [sender tag];
} else if ([sender isKindOfClass:[NSPopUpButton class]]) {
@@ -424,8 +424,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
// Temporarily set the display name to the default center coordinate instead
// of “Untitled” until the binding kicks in.
NSValue *coordinateValue = [NSValue valueWithMGLCoordinate:self.mapView.centerCoordinate];
self.displayName = [[NSValueTransformer valueTransformerForName:@"LocationCoordinate2DTransformer"]
NSString *coordinateString = [[NSValueTransformer valueTransformerForName:@"LocationCoordinate2DTransformer"]
transformedValue:coordinateValue];
self.displayName = [NSString stringWithFormat:@"%@ @ %f", coordinateString, _mapView.zoomLevel];
}
#pragma mark Debug methods