mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-23 15:03:27 -06:00
(#80) Fix for CAD navigation mode
Made sure that left mouse button + drag is panning. The view is still picked when clicking the left mouse button, unless there have been mouse moves/navigations that led to redrawing of the view.
This commit is contained in:
parent
9a3fbfe0d5
commit
a9ecbd9899
@ -40,6 +40,7 @@ void RiuCadNavigation::init()
|
||||
m_trackball->setCamera(m_viewer->mainCamera());
|
||||
m_isRotCenterInitialized = false;
|
||||
m_isRotating = false;
|
||||
m_navigationUpdated = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -58,7 +59,13 @@ bool RiuCadNavigation::handleInputEvent(QInputEvent* inputEvent)
|
||||
int translatedMousePosX = me->x();
|
||||
int translatedMousePosY = m_viewer->height() - me->y();
|
||||
|
||||
if (me->button() == Qt::MidButton)
|
||||
if (me->button() == Qt::LeftButton)
|
||||
{
|
||||
m_trackball->startNavigation(cvf::ManipulatorTrackball::PAN, translatedMousePosX, translatedMousePosY);
|
||||
m_isRotating = true;
|
||||
isEventHandled = true;
|
||||
}
|
||||
else if (me->button() == Qt::MidButton)
|
||||
{
|
||||
if (me->modifiers() & Qt::ShiftModifier)
|
||||
{
|
||||
@ -88,11 +95,10 @@ bool RiuCadNavigation::handleInputEvent(QInputEvent* inputEvent)
|
||||
isEventHandled = true;
|
||||
}
|
||||
}
|
||||
else if (me->button() == Qt::RightButton)
|
||||
|
||||
if (isEventHandled)
|
||||
{
|
||||
m_trackball->startNavigation(cvf::ManipulatorTrackball::PAN, translatedMousePosX, translatedMousePosY);
|
||||
m_isRotating = true;
|
||||
isEventHandled = true;
|
||||
m_navigationUpdated = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -101,12 +107,14 @@ bool RiuCadNavigation::handleInputEvent(QInputEvent* inputEvent)
|
||||
if (m_isRotating)
|
||||
{
|
||||
QMouseEvent * me = static_cast<QMouseEvent*>( inputEvent);
|
||||
if (me->button() == Qt::MidButton || me->button() == Qt::RightButton)
|
||||
if (me->button() == Qt::MidButton || me->button() == Qt::LeftButton)
|
||||
{
|
||||
m_trackball->endNavigation();
|
||||
//m_viewer->setCursor(RiuCursors::get(RiuCursors::PICK));
|
||||
m_isRotating = false;
|
||||
isEventHandled = true;
|
||||
|
||||
isEventHandled = m_navigationUpdated;
|
||||
m_navigationUpdated = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -126,6 +134,7 @@ bool RiuCadNavigation::handleInputEvent(QInputEvent* inputEvent)
|
||||
if (needRedraw)
|
||||
{
|
||||
m_viewer->update();
|
||||
m_navigationUpdated = true;
|
||||
}
|
||||
isEventHandled = true;
|
||||
}
|
||||
|
@ -43,4 +43,5 @@ protected:
|
||||
bool m_isRotCenterInitialized;
|
||||
bool m_isRotating;
|
||||
cvf::Vec3d m_pointOfInterest;
|
||||
bool m_navigationUpdated;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user