From a858e8ad442aee9268af6332a65765dff1332197 Mon Sep 17 00:00:00 2001 From: PaddleStroke Date: Tue, 9 Apr 2024 16:25:14 +0200 Subject: [PATCH] Assembly: Fixes slider special move mode.Fixes #13370 --- src/Gui/View3DInventorViewer.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 9d64f2f240..ee5313b081 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -2732,16 +2732,13 @@ SbVec3f View3DInventorViewer::getPointOnLine(const SbVec2s& pnt, const SbVec3f& SbVec3f pt, ptOnFocalPlaneAndOnLine, ptOnFocalPlane; SbPlane focalPlane = vol.getPlane(focalDist); vol.projectPointToLine(pnt2d, line); - - if (!focalPlane.intersect(line, ptOnFocalPlane)) { - return {}; // No intersection found - } + focalPlane.intersect(line, ptOnFocalPlane); // Check if line is orthogonal to the focal plane SbVec3f focalPlaneNormal = focalPlane.getNormal(); float dotProduct = fabs(axis.dot(focalPlaneNormal)); - if (dotProduct > 1.0 - 1e-6) { - return {}; + if (dotProduct > (1.0 - 1e-6)) { + return ptOnFocalPlane; } SbLine projectedLine = projectLineOntoPlane(axisCenter, axisCenter + axis, focalPlane); @@ -2751,10 +2748,10 @@ SbVec3f View3DInventorViewer::getPointOnLine(const SbVec2s& pnt, const SbVec3f& // - the line passing by ptOnFocalPlaneAndOnLine normal to focalPlane // - The line (axisCenter, axisCenter + axis) - // Line normal to focal plane through ptOnFocalPlane - SbLine normalLine(ptOnFocalPlane, ptOnFocalPlane + focalPlane.getNormal()); + // Line normal to focal plane through ptOnFocalPlaneAndOnLine + SbLine normalLine(ptOnFocalPlaneAndOnLine, ptOnFocalPlaneAndOnLine + focalPlaneNormal); SbLine axisLine(axisCenter, axisCenter + axis); - pt = intersection(ptOnFocalPlane, ptOnFocalPlane + focalPlane.getNormal(), axisCenter, axisCenter + axis); + pt = intersection(ptOnFocalPlaneAndOnLine, ptOnFocalPlaneAndOnLine + focalPlaneNormal, axisCenter, axisCenter + axis); return pt; }