From 2e9cf84ec2499e76071e3f27f804ade5757a6605 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sun, 15 Feb 2026 10:18:13 -0700 Subject: [PATCH] fix: Correct snap rectangle orientation for XY and XZ sketch planes Co-authored-by: aider (gemini/gemini-2.5-pro) --- src/ViewportWidget.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ViewportWidget.cpp b/src/ViewportWidget.cpp index b8fbba5..ccc2b73 100644 --- a/src/ViewportWidget.cpp +++ b/src/ViewportWidget.cpp @@ -146,15 +146,15 @@ void ViewportWidget::paintGL() glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBegin(GL_LINE_LOOP); if (m_currentPlane == SketchPlane::XY) { - glVertex3f(-rectSize, -rectSize, 0); - glVertex3f( rectSize, -rectSize, 0); - glVertex3f( rectSize, rectSize, 0); - glVertex3f(-rectSize, rectSize, 0); - } else if (m_currentPlane == SketchPlane::XZ) { glVertex3f(-rectSize, 0, -rectSize); glVertex3f( rectSize, 0, -rectSize); glVertex3f( rectSize, 0, rectSize); glVertex3f(-rectSize, 0, rectSize); + } else if (m_currentPlane == SketchPlane::XZ) { + glVertex3f(-rectSize, -rectSize, 0); + glVertex3f( rectSize, -rectSize, 0); + glVertex3f( rectSize, rectSize, 0); + glVertex3f(-rectSize, rectSize, 0); } else if (m_currentPlane == SketchPlane::YZ) { glVertex3f(0, -rectSize, -rectSize); glVertex3f(0, rectSize, -rectSize); @@ -170,15 +170,15 @@ void ViewportWidget::paintGL() glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBegin(GL_LINE_LOOP); if (m_currentPlane == SketchPlane::XY) { - glVertex3f(m_snapVertex.X() - rectSize, m_snapVertex.Y() - rectSize, m_snapVertex.Z()); - glVertex3f(m_snapVertex.X() + rectSize, m_snapVertex.Y() - rectSize, m_snapVertex.Z()); - glVertex3f(m_snapVertex.X() + rectSize, m_snapVertex.Y() + rectSize, m_snapVertex.Z()); - glVertex3f(m_snapVertex.X() - rectSize, m_snapVertex.Y() + rectSize, m_snapVertex.Z()); - } else if (m_currentPlane == SketchPlane::XZ) { glVertex3f(m_snapVertex.X() - rectSize, m_snapVertex.Y(), m_snapVertex.Z() - rectSize); glVertex3f(m_snapVertex.X() + rectSize, m_snapVertex.Y(), m_snapVertex.Z() - rectSize); glVertex3f(m_snapVertex.X() + rectSize, m_snapVertex.Y(), m_snapVertex.Z() + rectSize); glVertex3f(m_snapVertex.X() - rectSize, m_snapVertex.Y(), m_snapVertex.Z() + rectSize); + } else if (m_currentPlane == SketchPlane::XZ) { + glVertex3f(m_snapVertex.X() - rectSize, m_snapVertex.Y() - rectSize, m_snapVertex.Z()); + glVertex3f(m_snapVertex.X() + rectSize, m_snapVertex.Y() - rectSize, m_snapVertex.Z()); + glVertex3f(m_snapVertex.X() + rectSize, m_snapVertex.Y() + rectSize, m_snapVertex.Z()); + glVertex3f(m_snapVertex.X() - rectSize, m_snapVertex.Y() + rectSize, m_snapVertex.Z()); } else if (m_currentPlane == SketchPlane::YZ) { glVertex3f(m_snapVertex.X(), m_snapVertex.Y() - rectSize, m_snapVertex.Z() - rectSize); glVertex3f(m_snapVertex.X(), m_snapVertex.Y() + rectSize, m_snapVertex.Z() - rectSize);