#552 : Linked Views: Cleanup

This commit is contained in:
Magne Sjaastad
2016-12-15 19:00:36 +01:00
parent 4583dbf3b1
commit 27df0a20cf
2 changed files with 22 additions and 13 deletions

View File

@@ -490,6 +490,12 @@ void RimViewLinker::findNameAndIconFromView(QString* name, QIcon* icon, RimView*
//--------------------------------------------------------------------------------------------------
void RimViewLinker::updateCursorPosition(const RimView* sourceView, const cvf::Vec3d& domainCoord)
{
RimViewController* sourceViewLink = sourceView->viewController();
if (sourceViewLink && !sourceViewLink->showCursor())
{
return;
}
std::vector<RimView*> viewsToUpdate;
allViewsForCameraSync(sourceView, viewsToUpdate);
@@ -497,10 +503,13 @@ void RimViewLinker::updateCursorPosition(const RimView* sourceView, const cvf::V
{
if (destinationView == sourceView) continue;
RimViewController* viewLink = destinationView->viewController();
if (!viewLink) continue;
if (destinationView != m_masterView)
{
RimViewController* viewLink = destinationView->viewController();
if (!viewLink) continue;
if (!viewLink->showCursor()) continue;
if (!viewLink->showCursor()) continue;
}
RiuViewer* destinationViewer = destinationView->viewer();
if (destinationViewer)

View File

@@ -685,27 +685,27 @@ void RiuViewer::resizeGL(int width, int height)
//--------------------------------------------------------------------------------------------------
void RiuViewer::mouseMoveEvent(QMouseEvent* mouseEvent)
{
int translatedMousePosX = mouseEvent->pos().x();
int translatedMousePosY = height() - mouseEvent->pos().y();
cvf::Vec3d displayCoord(0, 0, 0);
if (mainCamera()->unproject(cvf::Vec3d(static_cast<double>(translatedMousePosX), static_cast<double>(translatedMousePosY), 0), &displayCoord))
if (m_rimView)
{
if (m_rimView)
RimViewLinker* viewLinker = m_rimView->assosiatedViewLinker();
if (viewLinker)
{
RimViewLinker* viewLinker = m_rimView->assosiatedViewLinker();
if (viewLinker)
int translatedMousePosX = mouseEvent->pos().x();
int translatedMousePosY = height() - mouseEvent->pos().y();
cvf::Vec3d displayCoord(0, 0, 0);
if (mainCamera()->unproject(cvf::Vec3d(static_cast<double>(translatedMousePosX), static_cast<double>(translatedMousePosY), 0), &displayCoord))
{
if (m_cursorPositionDomainCoords != cvf::Vec3d::UNDEFINED)
{
// Set undefined and redraw to make sure the cursor is not visible in the view
// Reset the extra cursor if the view currently is receiving mouse cursor events
// Set undefined and redraw to remove the previously displayed cursor
m_cursorPositionDomainCoords = cvf::Vec3d::UNDEFINED;
update();
}
cvf::ref<caf::DisplayCoordTransform> trans = m_rimView->displayCoordTransform();
cvf::Vec3d domainCoord = trans->transformToDomainCoord(displayCoord);
viewLinker->updateCursorPosition(m_rimView, domainCoord);