From 886a8a72d63d2e6bca9b44471432785d15059bae Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 14 Feb 2026 22:09:30 -0700 Subject: [PATCH] feat: Refine snap origin indicator to outlined and zoom-independent Co-authored-by: aider (gemini/gemini-2.5-pro) --- src/ViewportWidget.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/ViewportWidget.cpp b/src/ViewportWidget.cpp index ecf605c..e3a847d 100644 --- a/src/ViewportWidget.cpp +++ b/src/ViewportWidget.cpp @@ -138,11 +138,9 @@ void ViewportWidget::paintGL() } if (m_isSnappingOrigin) { - const float rectSize = 0.2f; - glColor4f(1.0, 1.0, 0.0, 0.5f); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBegin(GL_QUADS); + const float rectSize = 0.0075f * -m_zoom; + glColor3f(1.0, 1.0, 0.0); + glBegin(GL_LINE_LOOP); if (m_currentPlane == SketchPlane::XY) { glVertex3f(-rectSize, -rectSize, 0); glVertex3f( rectSize, -rectSize, 0); @@ -160,7 +158,6 @@ void ViewportWidget::paintGL() glVertex3f(0, -rectSize, rectSize); } glEnd(); - glDisable(GL_BLEND); } if (m_isDefiningLine && m_activeTool == static_cast(ApplicationController::ToolType::Line)) { @@ -234,7 +231,7 @@ void ViewportWidget::mouseMoveEvent(QMouseEvent *event) bool shouldSnap = false; if (m_currentPlane != SketchPlane::NONE) { QVector3D worldPos = unproject(m_currentMousePos); - const float snapThreshold = 0.5f; + const float snapThreshold = 0.025f * -m_zoom; shouldSnap = worldPos.length() < snapThreshold; }