fix: Correct snap rectangle orientation for XY and XZ sketch planes

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-15 10:18:13 -07:00
parent 7c86e77591
commit 2e9cf84ec2

View File

@@ -146,15 +146,15 @@ void ViewportWidget::paintGL()
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_LINE_LOOP); glBegin(GL_LINE_LOOP);
if (m_currentPlane == SketchPlane::XY) { 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);
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) { } else if (m_currentPlane == SketchPlane::YZ) {
glVertex3f(0, -rectSize, -rectSize); glVertex3f(0, -rectSize, -rectSize);
glVertex3f(0, rectSize, -rectSize); glVertex3f(0, rectSize, -rectSize);
@@ -170,15 +170,15 @@ void ViewportWidget::paintGL()
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_LINE_LOOP); glBegin(GL_LINE_LOOP);
if (m_currentPlane == SketchPlane::XY) { 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);
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) { } 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);
glVertex3f(m_snapVertex.X(), m_snapVertex.Y() + rectSize, m_snapVertex.Z() - rectSize); glVertex3f(m_snapVertex.X(), m_snapVertex.Y() + rectSize, m_snapVertex.Z() - rectSize);