feat: Make snap origin indicator 50% transparent and region rectangular
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -139,7 +139,9 @@ void ViewportWidget::paintGL()
|
||||
|
||||
if (m_isSnappingOrigin) {
|
||||
const float rectSize = 0.0075f * -m_zoom;
|
||||
glColor3f(1.0, 1.0, 0.0);
|
||||
glColor4f(1.0, 1.0, 0.0, 0.5f);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBegin(GL_LINE_LOOP);
|
||||
if (m_currentPlane == SketchPlane::XY) {
|
||||
glVertex3f(-rectSize, -rectSize, 0);
|
||||
@@ -158,6 +160,7 @@ void ViewportWidget::paintGL()
|
||||
glVertex3f(0, -rectSize, rectSize);
|
||||
}
|
||||
glEnd();
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
if (m_isDefiningLine && m_activeTool == static_cast<int>(ApplicationController::ToolType::Line)) {
|
||||
@@ -231,8 +234,21 @@ void ViewportWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
bool shouldSnap = false;
|
||||
if (m_currentPlane != SketchPlane::NONE) {
|
||||
QVector3D worldPos = unproject(m_currentMousePos);
|
||||
const float snapThreshold = 0.025f * -m_zoom;
|
||||
shouldSnap = worldPos.length() < snapThreshold;
|
||||
const float snapRectHalfSize = 0.0075f * -m_zoom;
|
||||
|
||||
switch (m_currentPlane) {
|
||||
case SketchPlane::XY:
|
||||
shouldSnap = qAbs(worldPos.x()) < snapRectHalfSize && qAbs(worldPos.y()) < snapRectHalfSize;
|
||||
break;
|
||||
case SketchPlane::XZ:
|
||||
shouldSnap = qAbs(worldPos.x()) < snapRectHalfSize && qAbs(worldPos.z()) < snapRectHalfSize;
|
||||
break;
|
||||
case SketchPlane::YZ:
|
||||
shouldSnap = qAbs(worldPos.y()) < snapRectHalfSize && qAbs(worldPos.z()) < snapRectHalfSize;
|
||||
break;
|
||||
case SketchPlane::NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldSnap != m_isSnappingOrigin) {
|
||||
|
||||
Reference in New Issue
Block a user