case QEvent::Wheel:
{
QWheelEvent* aEvent = (QWheelEvent*) e;
- double aDelta = aEvent->delta();
- double aScale = (aDelta < 0) ? 100./(-aDelta) : aDelta/100.;
- myViewPort->getView()->SetZoom(aScale);
+ myViewPort->startZoomAtPoint( aEvent->x(), aEvent->y() );
+ double delta = (double)( aEvent->delta() ) / ( 15 * 8 );
+ int x = aEvent->x();
+ int y = aEvent->y();
+ int x1 = (int)( aEvent->x() + width()*delta/100 );
+ int y1 = (int)( aEvent->y() + height()*delta/100 );
+ myViewPort->zoom( x, y, x1, y1 );
}
return true;
x, y );
}
+/*!
+ To handle mouse wheel forward event (reimplemented from #vtkInteractorStyle)
+*/
+void SVTK_InteractorStyle::OnMouseWheelForward()
+{
+ int x, y;
+ GetEventPosition( this->Interactor, x, y );
+ myOtherPoint = QPoint(x, y);
+}
+
+/*!
+ To handle mouse wheel backward event (reimplemented from #vtkInteractorStyle)
+*/
+void SVTK_InteractorStyle::OnMouseWheelBackward()
+{
+ int x, y;
+ GetEventPosition( this->Interactor, x, y );
+ myOtherPoint = QPoint(x, y);
+}
+
/*!
To handle mouse move event
*/
//! To handle right mouse button up event (reimplemented from #vtkInteractorStyle)
virtual void OnRightButtonUp();
+ //! To handle mouse wheel forward event (reimplemented from #vtkInteractorStyle)
+ virtual void OnMouseWheelForward();
+
+ //! To handle mouse wheel backward event (reimplemented from #vtkInteractorStyle)
+ virtual void OnMouseWheelBackward();
+
//! To handle keyboard event (reimplemented from #vtkInteractorStyle)
virtual void OnChar();
{
activateWindow();
setFocus();
+ GetDevice()->SetEventInformationFlipY(event->x(),
+ event->y(),
+ event->modifiers() & Qt::ControlModifier,
+ event->modifiers() & Qt::ShiftModifier);
+ if ( event->delta()>0)
+ GetDevice()->MouseWheelForwardEvent();
+ else
+ GetDevice()->MouseWheelBackwardEvent();
}