qstmgesturelib/recognisers/qstmzoomgesturerecogniser.cpp
changeset 16 3c88a81ff781
parent 3 0954f5dd2cd0
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
    89                     }
    89                     }
    90                     else {
    90                     else {
    91                         m_zoomtype = EZoomOut ;
    91                         m_zoomtype = EZoomOut ;
    92                     }
    92                     }
    93                     state = ELockToThisGesture ;    // keep zooming until release
    93                     state = ELockToThisGesture ;    // keep zooming until release
    94                     QStm_TwoPointGesture pgest(KUid, m_startingtouch, m_startingtouch);
    94                     QStm_TwoPointGesture pgest(KUid, m_startingtouch, m_startingtouch, puie->timestamp());
    95                     pgest.setLogging(m_loggingenabled) ;
    95                     pgest.setLogging(m_loggingenabled) ;
    96                     pgest.setDetails(&m_delta) ;
    96                     pgest.setDetails(&m_delta) ;
    97                     pgest.setName(m_zoomtype == EZoomIn ? QString("ZoomIn") : QString("ZoomOut")) ;
    97                     pgest.setName(m_zoomtype == EZoomIn ? QString("ZoomIn") : QString("ZoomOut")) ;
    98                     pgest.setType(m_zoomtype);
    98                     pgest.setType(m_zoomtype);
    99                     pgest.setTarget(puie->target());
    99                     pgest.setTarget(puie->target());
   112         else {
   112         else {
   113             // We are already zooming, calculate the changes in zooming factor if it looks we are still zooming
   113             // We are already zooming, calculate the changes in zooming factor if it looks we are still zooming
   114             if (eventCode == qstmUiEventEngine::ERelease) { // ERelease stops zooming
   114             if (eventCode == qstmUiEventEngine::ERelease) { // ERelease stops zooming
   115                 // We were zooming, but if there are multiple touches we are not any more
   115                 // We were zooming, but if there are multiple touches we are not any more
   116             	const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
   116             	const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
   117             	QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, puie->currentXY(), m_startingtouch);
   117                 QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, puie->currentXY(), m_startingtouch, puie->timestamp());
   118                 m_listener->gestureExit(pgest) ; // should we call this or not?
   118                 m_listener->gestureExit(pgest) ; // should we call this or not?
   119             }
   119             }
   120             else {   // all other UI events will keep on zooming
   120             else {   // all other UI events will keep on zooming
   121                 state = ELockToThisGesture ;    // Keep the gesture
   121                 state = ELockToThisGesture ;    // Keep the gesture
   122                 const QPoint& p = puie->currentXY() ;
   122                 const QPoint& p = puie->currentXY() ;
   126                 m_delta = adjustZoom(olddist, newdist) ;
   126                 m_delta = adjustZoom(olddist, newdist) ;
   127                 state = EGestureActive ;
   127                 state = EGestureActive ;
   128 
   128 
   129                 // Inform listener only if there is something to say
   129                 // Inform listener only if there is something to say
   130                 if (m_delta != 0) {
   130                 if (m_delta != 0) {
   131                     QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, p, m_startingtouch);
   131                     QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, p, m_startingtouch, puie->timestamp());
   132                     pgest.setLogging(m_loggingenabled) ;
   132                     pgest.setLogging(m_loggingenabled) ;
   133                     pgest.setDetails(&m_delta) ;
   133                     pgest.setDetails(&m_delta) ;
   134                     pgest.setName(m_zoomtype == EZoomIn ? QString("ZoomIn") : QString("ZoomOut")) ;
   134                     pgest.setName(m_zoomtype == EZoomIn ? QString("ZoomIn") : QString("ZoomOut")) ;
   135                     pgest.setType(m_zoomtype);
   135                     pgest.setType(m_zoomtype);
   136                     pgest.setTarget(puie->target());
   136                     pgest.setTarget(puie->target());
   142     }
   142     }
   143     else {
   143     else {
   144         if (m_zooming) {
   144         if (m_zooming) {
   145             // We were zooming, but if there are multiple touches we are not any more
   145             // We were zooming, but if there are multiple touches we are not any more
   146         	const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
   146         	const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
   147         	QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, puie->currentXY(), m_startingtouch);
   147             QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, puie->currentXY(), m_startingtouch, puie->timestamp());
   148         	pgest.setTarget(puie->target());
   148         	pgest.setTarget(puie->target());
   149             m_listener->gestureExit(pgest) ; // should we call this or not?
   149             m_listener->gestureExit(pgest) ; // should we call this or not?
   150         }
   150         }
   151         m_zooming = false ;
   151         m_zooming = false ;
   152     }
   152     }
   157 void QStm_ZoomGestureRecogniser::release(QStm_GestureEngineIf* pge)
   157 void QStm_ZoomGestureRecogniser::release(QStm_GestureEngineIf* pge)
   158 {
   158 {
   159     if (m_zooming) {
   159     if (m_zooming) {
   160         m_zooming = false ;
   160         m_zooming = false ;
   161     	const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
   161     	const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
   162     	QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, puie->currentXY(), m_startingtouch);
   162         QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, puie->currentXY(), m_startingtouch, puie->timestamp());
   163     	pgest.setTarget(puie->target());
   163     	pgest.setTarget(puie->target());
   164         m_listener->gestureExit(pgest) ; // should we call this or not?
   164         m_listener->gestureExit(pgest) ; // should we call this or not?
   165     }
   165     }
   166     if (m_loggingenabled) {
   166     if (m_loggingenabled) {
   167         LOGARG("QStm_ZoomGestureRecogniser: 0x%x release", this);
   167         LOGARG("QStm_ZoomGestureRecogniser: 0x%x release", this);