diff options
-rw-r--r-- | platform/macos/app/Base.lproj/MainMenu.xib | 14 | ||||
-rw-r--r-- | platform/macos/app/MapDocument.m | 22 |
2 files changed, 32 insertions, 4 deletions
diff --git a/platform/macos/app/Base.lproj/MainMenu.xib b/platform/macos/app/Base.lproj/MainMenu.xib index 72a97aa8cf..74cfb26388 100644 --- a/platform/macos/app/Base.lproj/MainMenu.xib +++ b/platform/macos/app/Base.lproj/MainMenu.xib @@ -506,6 +506,12 @@ <action selector="drawPolygonAndPolyLineAnnotations:" target="-1" id="EhT-CB-gee"/> </connections> </menuItem> + <menuItem title="Add Animated Annotation" id="Etf-JN-Aoc"> + <modifierMask key="keyEquivalentModifierMask"/> + <connections> + <action selector="drawAnimatedAnnotation:" target="-1" id="CYM-WB-s97"/> + </connections> + </menuItem> <menuItem title="Remove All Annotations" id="6rC-68-vk0"> <modifierMask key="keyEquivalentModifierMask"/> <connections> @@ -585,7 +591,7 @@ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <rect key="contentRect" x="109" y="131" width="350" height="84"/> - <rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/> + <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/> <view key="contentView" id="eA4-n3-qPe"> <rect key="frame" x="0.0" y="0.0" width="350" height="84"/> <autoresizingMask key="autoresizingMask"/> @@ -660,7 +666,7 @@ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" utility="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <rect key="contentRect" x="830" y="430" width="400" height="300"/> - <rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/> + <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/> <view key="contentView" id="8ha-hw-zOD"> <rect key="frame" x="0.0" y="0.0" width="400" height="300"/> <autoresizingMask key="autoresizingMask"/> @@ -668,11 +674,11 @@ <scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Q8b-0e-dLv"> <rect key="frame" x="-1" y="20" width="402" height="281"/> <clipView key="contentView" id="J9U-Yx-o2S"> - <rect key="frame" x="1" y="0.0" width="400" height="280"/> + <rect key="frame" x="1" y="0.0" width="400" height="265"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" autosaveColumns="NO" headerView="MAZ-Iq-hBi" id="Ato-Vu-HYT"> - <rect key="frame" x="0.0" y="0.0" width="423" height="257"/> + <rect key="frame" x="0.0" y="0.0" width="423" height="242"/> <autoresizingMask key="autoresizingMask"/> <size key="intercellSpacing" width="3" height="2"/> <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index 5d05bacc5b..a6c9e62829 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -405,6 +405,25 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.mapView addAnnotation:line]; } +- (IBAction)drawAnimatedAnnotation:(id)sender { + DroppedPinAnnotation *annotation = [[DroppedPinAnnotation alloc] init]; + [self.mapView addAnnotation:annotation]; + + [NSTimer scheduledTimerWithTimeInterval:1.0/60.0 + target:self + selector:@selector(updateAnimatedAnnotation:) + userInfo:annotation + repeats:YES]; +} + +- (void)updateAnimatedAnnotation:(NSTimer *)timer { + DroppedPinAnnotation *annotation = timer.userInfo; + double angle = timer.fireDate.timeIntervalSinceReferenceDate; + annotation.coordinate = CLLocationCoordinate2DMake( + sin(angle) * 20, + cos(angle) * 20); +} + #pragma mark Offline packs - (IBAction)addOfflinePack:(id)sender { @@ -613,6 +632,9 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio if (menuItem.action == @selector(dropManyPins:)) { return YES; } + if (menuItem.action == @selector(drawAnimatedAnnotation:)) { + return YES; + } if (menuItem.action == @selector(removeAllAnnotations:)) { return self.mapView.annotations.count > 0; } |