182 } |
182 } |
183 |
183 |
184 /** @return direction between last two points */ |
184 /** @return direction between last two points */ |
185 TXnGestureCode TXnGestureRecogniser::LastDirection( const TXnPointArray& aPoints ) const |
185 TXnGestureCode TXnGestureRecogniser::LastDirection( const TXnPointArray& aPoints ) const |
186 { |
186 { |
187 if ( aPoints.Count() > minPointCount ) |
187 TXnGestureCode ret = EGestureUnknown; |
188 { |
188 |
189 // return direction between latest and previous points. |
189 if ( ( aPoints.Count() > 0 ) && |
190 // pick the previous point that is different than the last point |
190 ( GestureLength( aPoints ) >= KMinSwipeLength )) |
191 // because while using an x or y filter array, more than one |
191 { |
192 // sequential points may look like the same point because |
192 if ( aPoints.Count() > minPointCount ) |
193 // the differing coordinate coordinate is filtered out. For example, |
193 { |
194 // if dragging left and slightly up, many y coordinates will have the |
194 // return direction between latest and previous points. |
195 // same value, while only x differs. |
195 // pick the previous point that is different than the last point |
196 return Direction( aPoints[ aPoints.Count() - minPointCount ], |
196 // because while using an x or y filter array, more than one |
197 aPoints[ aPoints.Count() - 1 ] ); |
197 // sequential points may look like the same point because |
198 } |
198 // the differing coordinate coordinate is filtered out. For example, |
199 return GeneralDirection( aPoints ); |
199 // if dragging left and slightly up, many y coordinates will have the |
|
200 // same value, while only x differs. |
|
201 ret = Direction( aPoints[ aPoints.Count() - minPointCount ], |
|
202 aPoints[ aPoints.Count() - 1 ] ); |
|
203 } |
|
204 else |
|
205 { |
|
206 ret = GeneralDirection( aPoints ); |
|
207 } |
|
208 } |
|
209 |
|
210 return ret; |
200 } |
211 } |
201 |
212 |
202 // ---------------------------------------------------------------------------- |
213 // ---------------------------------------------------------------------------- |
203 // Return gesture code of a gesture formed by a sequence of points |
214 // Return gesture code of a gesture formed by a sequence of points |
204 // ---------------------------------------------------------------------------- |
215 // ---------------------------------------------------------------------------- |