forked from organicmaps/organicmaps
[ios] Detect clicks on already added bookmarks
This commit is contained in:
parent
c70258b477
commit
c8f898c461
2 changed files with 20 additions and 10 deletions
|
@ -119,10 +119,8 @@
|
|||
- (void) showInView:(UIView *)view atPoint:(CGPoint)pt
|
||||
{
|
||||
if (isDisplayed)
|
||||
{
|
||||
NSLog(@"Already displaying the BalloonView");
|
||||
return;
|
||||
}
|
||||
[self hide];
|
||||
|
||||
isDisplayed = YES;
|
||||
|
||||
CGFloat const w = self.pinImage.bounds.size.width;
|
||||
|
|
|
@ -137,14 +137,26 @@
|
|||
|
||||
- (void)onSingleTap:(NSValue *)point
|
||||
{
|
||||
if (m_bookmark.isDisplayed)
|
||||
[m_bookmark hide];
|
||||
// Try to check if we've clicked on bookmark
|
||||
CGPoint const pixelPos = [point CGPointValue];
|
||||
Bookmark const * bm = GetFramework().GetBookmark(m2::PointD(pixelPos.x, pixelPos.y));
|
||||
if (!bm)
|
||||
{
|
||||
if (m_bookmark.isDisplayed)
|
||||
[m_bookmark hide];
|
||||
else
|
||||
{
|
||||
CGPoint const globalPos = [self viewPoint2GlobalPoint:pixelPos];
|
||||
m_bookmark.globalPosition = globalPos;
|
||||
[m_bookmark showInView:self.view atPoint:pixelPos];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CGPoint const pixelPos = [point CGPointValue];
|
||||
CGPoint const globalPos = [self viewPoint2GlobalPoint:pixelPos];
|
||||
m_bookmark.globalPosition = globalPos;
|
||||
[m_bookmark showInView:self.view atPoint:pixelPos];
|
||||
// Already added bookmark was clicked
|
||||
m2::PointD const globalPos = bm->GetOrg();
|
||||
m_bookmark.globalPosition = CGPointMake(globalPos.x, globalPos.y);
|
||||
[m_bookmark showInView:self.view atPoint:[self globalPoint2ViewPoint:m_bookmark.globalPosition]];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue