From 731aabc0f2a5ab10a2b1791da195f678d86bc4d6 Mon Sep 17 00:00:00 2001 From: Igor Khmurets Date: Mon, 24 Mar 2014 14:53:46 +0300 Subject: [PATCH] [ios] Fixed place page context views behavior --- iphone/Maps/Classes/ContextViews.mm | 10 ++++++++-- iphone/Maps/Classes/PlacePageView.mm | 10 ++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/iphone/Maps/Classes/ContextViews.mm b/iphone/Maps/Classes/ContextViews.mm index fae65f9504..bd66370ffe 100644 --- a/iphone/Maps/Classes/ContextViews.mm +++ b/iphone/Maps/Classes/ContextViews.mm @@ -4,6 +4,7 @@ #import "LocationManager.h" #import "MapsAppDelegate.h" #import "Framework.h" +#include "../../../map/measurement_utils.hpp" @implementation LocationImageView @@ -122,13 +123,16 @@ { double const longitude = MercatorBounds::XToLon(self.pinPoint.x); double const latitude = MercatorBounds::YToLat(self.pinPoint.y); - NSString * coordinates = [NSString stringWithFormat:@"%@ %@", [self coordinateString:longitude digitsCount:7], [self coordinateString:latitude digitsCount:7]]; + NSString * coordinates = [NSString stringWithFormat:@"%@ %@", [self coordinateString:longitude digitsCount:6], [self coordinateString:latitude digitsCount:6]]; [UIPasteboard generalPasteboard].string = coordinates; } - (void)copyDegreesLocation:(id)sender { - [self copyDecimalLocation:nil]; + double const latitude = MercatorBounds::YToLat(self.pinPoint.y); + double const longitude = MercatorBounds::XToLon(self.pinPoint.x); + string const coordinates = MeasurementUtils::FormatLatLonAsDMS(latitude, longitude, 3); + [UIPasteboard generalPasteboard].string = [NSString stringWithUTF8String:coordinates.c_str()]; } - (UILabel *)longitudeValueLabel @@ -202,6 +206,8 @@ self = [super initWithFrame:frame]; self.userInteractionEnabled = YES; + UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]; + [self addGestureRecognizer:tap]; return self; } diff --git a/iphone/Maps/Classes/PlacePageView.mm b/iphone/Maps/Classes/PlacePageView.mm index 0cb74e3b2c..eeda644b6c 100644 --- a/iphone/Maps/Classes/PlacePageView.mm +++ b/iphone/Maps/Classes/PlacePageView.mm @@ -88,6 +88,10 @@ UILongPressGestureRecognizer * locationPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(locationPress:)]; [self.locationView addGestureRecognizer:locationPress]; + UITapGestureRecognizer * locationTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideMenuTap:)]; + [self.locationView addGestureRecognizer:locationTap]; + UITapGestureRecognizer * addressTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideMenuTap:)]; + [self.addressLabel addGestureRecognizer:addressTap]; UILongPressGestureRecognizer * titlePress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(labelPress:)]; [self.titleLabel addGestureRecognizer:titlePress]; @@ -242,12 +246,18 @@ - (void)tap:(UITapGestureRecognizer *)sender { + [[UIMenuController sharedMenuController] setMenuVisible:NO animated:YES]; if (self.state == PlacePageStateBitShown) [self setState:PlacePageStateOpened animated:YES]; else if (self.state == PlacePageStateOpened) [self setState:PlacePageStateBitShown animated:YES]; } +- (void)hideMenuTap:(UITapGestureRecognizer *)sender +{ + [[UIMenuController sharedMenuController] setMenuVisible:NO animated:YES]; +} + - (void)pan:(UIPanGestureRecognizer *)sender { if (sender.state == UIGestureRecognizerStateBegan)