mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#168 Finalized. Zoom along ray is now updated to cope with parallel projection. The code in the different navigations are cleaned up a bit, and alligned
This commit is contained in:
@@ -55,8 +55,9 @@ bool RiuGeoQuestNavigation::handleInputEvent(QInputEvent* inputEvent)
|
||||
case QEvent::MouseButtonPress:
|
||||
{
|
||||
QMouseEvent * me = static_cast<QMouseEvent*>( inputEvent);
|
||||
int translatedMousePosX = me->x();
|
||||
int translatedMousePosY = m_viewer->height() - me->y();
|
||||
|
||||
int translatedMousePosX, translatedMousePosY;
|
||||
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
|
||||
|
||||
if (me->button() == Qt::LeftButton)
|
||||
{
|
||||
@@ -74,7 +75,6 @@ bool RiuGeoQuestNavigation::handleInputEvent(QInputEvent* inputEvent)
|
||||
}
|
||||
|
||||
m_trackball->startNavigation(cvf::ManipulatorTrackball::ROTATE, translatedMousePosX, translatedMousePosY);
|
||||
//m_viewer->setCursor(RICursors::get(RICursors::ROTATE));
|
||||
m_isNavigating = true;
|
||||
m_hasMovedMouseDuringNavigation = false;
|
||||
isEventHandled = true;
|
||||
@@ -113,8 +113,9 @@ bool RiuGeoQuestNavigation::handleInputEvent(QInputEvent* inputEvent)
|
||||
if (m_isRotCenterInitialized)
|
||||
{
|
||||
QMouseEvent * me = static_cast<QMouseEvent*>( inputEvent);
|
||||
int translatedMousePosX = me->x();
|
||||
int translatedMousePosY = m_viewer->height() - me->y();
|
||||
|
||||
int translatedMousePosX, translatedMousePosY;
|
||||
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
|
||||
|
||||
if (m_isNavigating)
|
||||
{
|
||||
@@ -146,19 +147,14 @@ bool RiuGeoQuestNavigation::handleInputEvent(QInputEvent* inputEvent)
|
||||
initializeRotationCenter();
|
||||
if (m_isRotCenterInitialized)
|
||||
{
|
||||
QWheelEvent* we = static_cast<QWheelEvent*> ( inputEvent);
|
||||
int translatedMousePosX = we->x();
|
||||
int translatedMousePosY = m_viewer->height() - we->y();
|
||||
int delta = we->delta();
|
||||
QWheelEvent* we = static_cast<QWheelEvent*>(inputEvent);
|
||||
|
||||
cvf::ref<cvf::Ray> ray;
|
||||
if (delta < 0)
|
||||
ray = m_viewer->mainCamera()->rayFromWindowCoordinates(translatedMousePosX, translatedMousePosY);
|
||||
else
|
||||
ray = m_viewer->mainCamera()->rayFromWindowCoordinates((int)(1.0*translatedMousePosX), (int)(1.0*translatedMousePosY));
|
||||
int translatedMousePosX, translatedMousePosY;
|
||||
cvfEventPos(we->x(), we->y(), &translatedMousePosX, &translatedMousePosY);
|
||||
|
||||
zoomAlongRay(ray.p(), -delta);
|
||||
cvf::ref<cvf::Ray> ray = createZoomRay(translatedMousePosX, translatedMousePosY);
|
||||
|
||||
zoomAlongRay(ray.p(), -we->delta());
|
||||
}
|
||||
isEventHandled = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user