feat: Refine snap origin indicator to outlined and zoom-independent

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-14 22:09:30 -07:00
parent d3cb5e36f9
commit 886a8a72d6

View File

@@ -138,11 +138,9 @@ void ViewportWidget::paintGL()
} }
if (m_isSnappingOrigin) { if (m_isSnappingOrigin) {
const float rectSize = 0.2f; const float rectSize = 0.0075f * -m_zoom;
glColor4f(1.0, 1.0, 0.0, 0.5f); glColor3f(1.0, 1.0, 0.0);
glEnable(GL_BLEND); glBegin(GL_LINE_LOOP);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_QUADS);
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);
@@ -160,7 +158,6 @@ void ViewportWidget::paintGL()
glVertex3f(0, -rectSize, rectSize); glVertex3f(0, -rectSize, rectSize);
} }
glEnd(); glEnd();
glDisable(GL_BLEND);
} }
if (m_isDefiningLine && m_activeTool == static_cast<int>(ApplicationController::ToolType::Line)) { if (m_isDefiningLine && m_activeTool == static_cast<int>(ApplicationController::ToolType::Line)) {
@@ -234,7 +231,7 @@ void ViewportWidget::mouseMoveEvent(QMouseEvent *event)
bool shouldSnap = false; bool shouldSnap = false;
if (m_currentPlane != SketchPlane::NONE) { if (m_currentPlane != SketchPlane::NONE) {
QVector3D worldPos = unproject(m_currentMousePos); QVector3D worldPos = unproject(m_currentMousePos);
const float snapThreshold = 0.5f; const float snapThreshold = 0.025f * -m_zoom;
shouldSnap = worldPos.length() < snapThreshold; shouldSnap = worldPos.length() < snapThreshold;
} }