refactor: Extract camera logic to Camera class
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -16,17 +16,12 @@ class SketchGrid;
|
||||
class Document;
|
||||
class FeatureBrowser;
|
||||
class SketchFeature;
|
||||
class Camera;
|
||||
|
||||
class ViewportWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(float xRotation READ xRotation WRITE setXRotation)
|
||||
Q_PROPERTY(float yRotation READ yRotation WRITE setYRotation)
|
||||
Q_PROPERTY(float zoom READ zoom WRITE setZoom)
|
||||
Q_PROPERTY(float panX READ panX WRITE setPanX)
|
||||
Q_PROPERTY(float panY READ panY WRITE setPanY)
|
||||
|
||||
public:
|
||||
enum class SketchPlane {
|
||||
NONE,
|
||||
@@ -46,21 +41,6 @@ public slots:
|
||||
void onPlaneSelectionModeStarted();
|
||||
void onActiveToolChanged(int tool);
|
||||
|
||||
float xRotation() const;
|
||||
void setXRotation(float angle);
|
||||
|
||||
float yRotation() const;
|
||||
void setYRotation(float angle);
|
||||
|
||||
float zoom() const;
|
||||
void setZoom(float value);
|
||||
|
||||
float panX() const;
|
||||
void setPanX(float value);
|
||||
|
||||
float panY() const;
|
||||
void setPanY(float value);
|
||||
|
||||
signals:
|
||||
void lineAdded(const gp_Pnt& start, const gp_Pnt& end);
|
||||
void planeSelected(SketchPlane plane);
|
||||
@@ -84,6 +64,7 @@ private:
|
||||
ViewportWidget::SketchPlane checkPlaneSelection(const QPoint& screenPos);
|
||||
|
||||
QMatrix4x4 projection;
|
||||
Camera* m_camera = nullptr;
|
||||
ViewCube* m_viewCube;
|
||||
SketchGrid* m_sketchGrid = nullptr;
|
||||
FeatureBrowser* m_featureBrowser = nullptr;
|
||||
@@ -106,18 +87,7 @@ private:
|
||||
QMap<int, QSvgRenderer*> m_toolIcons;
|
||||
QSvgRenderer* m_cursorRenderer = nullptr;
|
||||
|
||||
float m_xRot = 35.264f * 16.0f; // Default to isometric view
|
||||
float m_yRot = -45.0f * 16.0f; // Default to isometric view
|
||||
float m_zoom = -5.0f;
|
||||
float m_panX = 0;
|
||||
float m_panY = 0;
|
||||
QPoint lastPos;
|
||||
|
||||
float m_savedXRot = 0;
|
||||
float m_savedYRot = 0;
|
||||
float m_savedZoom = -5.0f;
|
||||
float m_savedPanX = 0;
|
||||
float m_savedPanY = 0;
|
||||
};
|
||||
|
||||
#endif // VIEWPORTWIDGET_H
|
||||
|
||||
Reference in New Issue
Block a user