feat: Implement in-viewport sketch plane selection

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-15 11:09:28 -07:00
parent d2fe4226ea
commit 8424097127
4 changed files with 181 additions and 36 deletions

View File

@@ -43,6 +43,7 @@ public:
public slots:
void onSketchModeStarted(SketchPlane plane);
void onSketchModeEnded();
void onPlaneSelectionModeStarted();
void onActiveToolChanged(int tool);
float xRotation() const;
@@ -62,6 +63,7 @@ public slots:
signals:
void lineAdded(const gp_Pnt& start, const gp_Pnt& end);
void planeSelected(SketchPlane plane);
protected:
void initializeGL() override;
@@ -75,9 +77,11 @@ protected:
private:
QVector3D project(const QVector3D& worldCoord, const QMatrix4x4& modelView, const QMatrix4x4& projection, const QRect& viewport);
QVector3D unproject(const QPoint& screenPos);
QVector3D unproject(const QPoint& screenPos, SketchPlane plane);
void drawAxisLabels(QPainter& painter, const QMatrix4x4& modelView, const QMatrix4x4& projection);
void drawSketch(const SketchFeature* sketch);
void drawSelectionPlanes();
ViewportWidget::SketchPlane checkPlaneSelection(const QPoint& screenPos);
QMatrix4x4 projection;
ViewCube* m_viewCube;
@@ -86,6 +90,9 @@ private:
Document* m_document = nullptr;
SketchPlane m_currentPlane = SketchPlane::NONE;
bool m_isSelectingPlane = false;
SketchPlane m_highlightedPlane = SketchPlane::NONE;
int m_activeTool = 0;
bool m_isDefiningLine = false;
gp_Pnt m_firstLinePoint;