mulwidgets/gesturehelper/src/gesture.cpp
branchRCL_3
changeset 17 514d98f21c43
parent 0 e83bab7cf002
equal deleted inserted replaced
15:125793e17004 17:514d98f21c43
   907 // PinchPercent
   907 // PinchPercent
   908 // ----------------------------------------------------------------------------
   908 // ----------------------------------------------------------------------------
   909 //
   909 //
   910 TInt CGesture::PinchPercent() const
   910 TInt CGesture::PinchPercent() const
   911     {
   911     {
   912     return (iPinchEndDistance*100/iPinchStartDistance);
   912 	// Added 0.5 to avoid 5.7 getting rounded off to 5.
       
   913     return (iPinchEndDistance*100/iPinchStartDistance) + 0.5;	
   913     }
   914     }
   914 
   915 
   915 // ----------------------------------------------------------------------------
   916 // ----------------------------------------------------------------------------
   916 // PinchCentrePoint
   917 // PinchCentrePoint
   917 // ----------------------------------------------------------------------------
   918 // ----------------------------------------------------------------------------
   920     {
   921     {
   921     if( iPoints.Count() <= 0 || iSecondaryPoints.Count() <= 0 )
   922     if( iPoints.Count() <= 0 || iSecondaryPoints.Count() <= 0 )
   922         {
   923         {
   923         return TPoint(0,0);
   924         return TPoint(0,0);
   924         }
   925         }
   925     TInt greaterX = iPoints[0].iPos.iX > iSecondaryPoints[0].iPos.iX ? iPoints[0].iPos.iX : iSecondaryPoints[0].iPos.iX;
   926     return TPoint( (iPoints[0].iPos.iX + iSecondaryPoints[0].iPos.iX)/2, (iPoints[0].iPos.iY + iSecondaryPoints[0].iPos.iY)/2);
   926     TInt greaterY = iPoints[0].iPos.iY > iSecondaryPoints[0].iPos.iY ? iPoints[0].iPos.iY : iSecondaryPoints[0].iPos.iY; 
       
   927     return TPoint( (Abs(iPoints[0].iPos.iX - iSecondaryPoints[0].iPos.iX)/2 + greaterX), (Abs(iPoints[0].iPos.iY - iSecondaryPoints[0].iPos.iY)/2 + greaterY));
       
   928     }
   927     }
   929 
   928 
   930 // end of file
   929 // end of file
   931 
   930