--- a/src/ui/canvas.h Wed May 25 17:56:30 2022 +0300 +++ b/src/ui/canvas.h Wed May 25 18:29:49 2022 +0300 @@ -19,8 +19,8 @@ std::vector<glm::vec3> previewPolygon; glm::vec3 previewPoint; bool isconcave = false; + EditingMode mode = SelectMode; }; - class Canvas : public PartRenderer { Q_OBJECT @@ -44,8 +44,8 @@ const glm::mat4& getGridMatrix() const; void closeShape(); glm::vec3 cameraVector() const; - DrawState drawState; - EditingMode mode = SelectMode; + std::optional<glm::vec3> worldPosition; + DrawState* drawState = nullptr; public Q_SLOTS: void handleSelectionChange(const QSet<ldraw::id_t>& selectedIds, const QSet<ldraw::id_t>& deselectedIds); void rebuildVertices(Document *document); @@ -59,8 +59,8 @@ Q_SIGNALS: void newStatusText(const QString& newStatusText); void selectionChanged(const QSet<ldraw::id_t>& newSelection); - void mouseClick(Canvas* canvas, QMouseEvent* event); - void mouseMove(Canvas* canvas, QMouseEvent* event); + void mouseClick(QMouseEvent* event); + void mouseMove(QMouseEvent* event); private: bool isGridPerpendicularToScreen(float threshold) const; QVector<QPointF> convertWorldPointsToScreenPoints(const std::vector<glm::vec3>& worldPoints) const; @@ -69,7 +69,6 @@ std::optional<GridProgram> gridProgram; std::optional<AxesProgram> axesProgram; std::optional<VertexProgram> vertexProgram; - std::optional<glm::vec3> worldPosition; glm::mat4 gridMatrix; geom::Plane gridPlane; int totalMouseMove = 0;