From 4d167d9393c19d3b65c652a775587403380b7ef9 Mon Sep 17 00:00:00 2001 From: rachytski Date: Fri, 27 May 2011 23:25:57 +0300 Subject: [PATCH] zoom out on double-tap. closes #268 --- iphone/Maps/Classes/MapViewController.mm | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index cb946deb4b..3ac0a332f2 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -267,8 +267,14 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context) [self updatePointsFromEvent:event]; [self stopCurrentAction]; - if ((((UITouch*)[touches anyObject]).tapCount == 2) && ([[event allTouches] count] < 2)) - m_framework->ScaleToPoint(ScaleToPointEvent(m_Pt1.x, m_Pt1.y, 2)); + int tapCount = ((UITouch*)[touches anyObject]).tapCount; + int touchesCount = [[event allTouches] count]; + + if (tapCount == 2 && (touchesCount == 1) && m_isSticking) + m_framework->ScaleToPoint(ScaleToPointEvent(m_Pt1.x, m_Pt1.y, 2.0)); + + if ((touchesCount == 2) && (tapCount = 1) && m_isSticking) + m_framework->Scale(0.5); } - (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event @@ -276,8 +282,14 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context) [self updatePointsFromEvent:event]; [self stopCurrentAction]; - if ((((UITouch*)[touches anyObject]).tapCount == 2) && ([[event allTouches] count] < 2)) - m_framework->ScaleToPoint(ScaleToPointEvent(m_Pt1.x, m_Pt1.y, 2)); + int tapCount = ((UITouch*)[touches anyObject]).tapCount; + int touchesCount = [[event allTouches] count]; + + if (tapCount == 2 && (touchesCount == 1) && m_isSticking) + m_framework->ScaleToPoint(ScaleToPointEvent(m_Pt1.x, m_Pt1.y, 2.0)); + + if ((touchesCount == 2) && (tapCount = 1) && m_isSticking) + m_framework->Scale(0.5); } - (void)onPaint