Mon, 27 Sep 2021 21:04:45 +0300
work on saving
96 | 1 | #pragma once |
2 | #include "basetool.h" | |
3 | ||
4 | class DrawTool : public BaseTool | |
5 | { | |
6 | Q_OBJECT | |
7 | ||
8 | public: | |
126
a7c720aff97c
moved ObjectEditor under SelectTool
Teemu Piippo <teemu@hecknology.net>
parents:
125
diff
changeset
|
9 | Q_INVOKABLE DrawTool(Model* model, QObject* parent = nullptr); |
96 | 10 | |
105
6ca6e8c647d4
added preview layer code and fixed build warnings
Teemu Piippo <teemu@hecknology.net>
parents:
104
diff
changeset
|
11 | QString name() const override; |
6ca6e8c647d4
added preview layer code and fixed build warnings
Teemu Piippo <teemu@hecknology.net>
parents:
104
diff
changeset
|
12 | QString toolTip() const override; |
121
000781318c36
added right click support for draw tool
Teemu Piippo <teemu@hecknology.net>
parents:
111
diff
changeset
|
13 | bool mouseClick(Document* document, Canvas* canvas, QMouseEvent* event) override; |
000781318c36
added right click support for draw tool
Teemu Piippo <teemu@hecknology.net>
parents:
111
diff
changeset
|
14 | bool mouseMove(Document* document, Canvas* canvas, QMouseEvent* event) override; |
125
f127982d3412
Move tools under Document instead of MainWindow
Teemu Piippo <teemu@hecknology.net>
parents:
124
diff
changeset
|
15 | bool keyReleased(Document*, Canvas* canvas, QKeyEvent* event) override; |
106 | 16 | void reset() override; |
109
40a1cf2f38f5
replaced preview layers in favor of overpainting callback
Teemu Piippo <teemu@hecknology.net>
parents:
108
diff
changeset
|
17 | void overpaint(Canvas*, QPainter*) const override; |
106 | 18 | private: |
111
1f42c03fafca
Draw tool actually adds objects now
Teemu Piippo <teemu@hecknology.net>
parents:
109
diff
changeset
|
19 | void closeShape(Document *document); |
106 | 20 | std::vector<glm::vec3> polygon; |
109
40a1cf2f38f5
replaced preview layers in favor of overpainting callback
Teemu Piippo <teemu@hecknology.net>
parents:
108
diff
changeset
|
21 | std::vector<glm::vec3> previewPolygon; |
40a1cf2f38f5
replaced preview layers in favor of overpainting callback
Teemu Piippo <teemu@hecknology.net>
parents:
108
diff
changeset
|
22 | glm::vec3 previewPoint; |
122
b54b350dff5d
Show concave polygons as red while drawing
Teemu Piippo <teemu@hecknology.net>
parents:
121
diff
changeset
|
23 | bool isconcave = false; |
121
000781318c36
added right click support for draw tool
Teemu Piippo <teemu@hecknology.net>
parents:
111
diff
changeset
|
24 | void updatePreviewPolygon(); |
96 | 25 | }; |