diff --git a/ApplicationCode/UserInterface/RiuCadNavigation.cpp b/ApplicationCode/UserInterface/RiuCadNavigation.cpp index a02fe70131..ba38ba5c97 100644 --- a/ApplicationCode/UserInterface/RiuCadNavigation.cpp +++ b/ApplicationCode/UserInterface/RiuCadNavigation.cpp @@ -166,21 +166,7 @@ bool RiuCadNavigation::handleInputEvent(QInputEvent* inputEvent) else ray = m_viewer->mainCamera()->rayFromWindowCoordinates((int)(1.0*translatedMousePosX), (int)(1.0*translatedMousePosY)); - if (ray.notNull() && abs(we->delta()) > 0) - { - cvf::Vec3d pos, vrp, up; - m_viewer->mainCamera()->toLookAt(&pos, &vrp, &up); - - double scale = -we->delta()/8.0 * 1.0/150 * (pos - m_pointOfInterest).length(); - cvf::Vec3d trans = scale * ray->direction(); - cvf::Vec3d newPos = pos + trans; - cvf::Vec3d newVrp = vrp + trans; - - m_viewer->mainCamera()->setFromLookAt(newPos,newVrp, up ); - - m_viewer->updateParallelProjectionHeightFromMoveZoom(m_pointOfInterest); - m_viewer->navigationPolicyUpdate(); - } + zoomAlongRay(ray.p(), -we->delta()); } isEventHandled = true; } diff --git a/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp b/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp index 3b10e34ab1..72a705b7d6 100644 --- a/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp +++ b/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp @@ -177,21 +177,7 @@ bool caf::CadNavigation::handleInputEvent(QInputEvent* inputEvent) else ray = m_viewer->mainCamera()->rayFromWindowCoordinates((int)(1.0*translatedMousePosX), (int)(1.0*translatedMousePosY)); - if (ray.notNull() && abs(we->delta()) > 0) - { - cvf::Vec3d pos, vrp, up; - m_viewer->mainCamera()->toLookAt(&pos, &vrp, &up); - - double scale = -we->delta()/8.0 * 1.0/150 * (pos - m_pointOfInterest).length(); - cvf::Vec3d trans = scale * ray->direction(); - cvf::Vec3d newPos = pos + trans; - cvf::Vec3d newVrp = vrp + trans; - - m_viewer->mainCamera()->setFromLookAt(newPos,newVrp, up ); - - m_viewer->updateParallelProjectionHeightFromMoveZoom(m_pointOfInterest); - m_viewer->navigationPolicyUpdate(); - } + zoomAlongRay(ray.p(), -we->delta()); } isEventHandled = true; }