src/ui/canvas.cpp

changeset 108
94c92c923713
parent 107
02f142b399b1
child 109
40a1cf2f38f5
equal deleted inserted replaced
107:02f142b399b1 108:94c92c923713
75 this->gridMatrix = glm::rotate(this->gridMatrix, PI<float> / 2, glm::vec3{0, 1, 0}); 75 this->gridMatrix = glm::rotate(this->gridMatrix, PI<float> / 2, glm::vec3{0, 1, 0});
76 } 76 }
77 this->updateGridMatrix(); 77 this->updateGridMatrix();
78 this->update(); 78 this->update();
79 } 79 }
80 MouseMoveInfo info;
81 info.invoker = this;
82 info.worldPosition = this->worldPosition;
83 emit mouseMove(info);
80 PartRenderer::mouseMoveEvent(event); 84 PartRenderer::mouseMoveEvent(event);
81 } 85 }
82 86
83 void Canvas::mousePressEvent(QMouseEvent* event) 87 void Canvas::mousePressEvent(QMouseEvent* event)
84 { 88 {
223 renderText(axis.text, *intersection); 227 renderText(axis.text, *intersection);
224 } 228 }
225 } 229 }
226 for (const PreviewLayer& previewLayer : this->previewLayers) 230 for (const PreviewLayer& previewLayer : this->previewLayers)
227 { 231 {
228 painter.setBrush({previewLayer.color}); 232 for (const PreviewLayer::Polygon& polygon3d : previewLayer.polygons)
229 for (const geom::NPolygon& polygon3d : previewLayer.polygons)
230 { 233 {
234 painter.setBrush(polygon3d.brush);
235 painter.setPen(polygon3d.pen);
231 QVector<QPointF> points2d; 236 QVector<QPointF> points2d;
232 points2d.reserve(polygon3d.points.size()); 237 points2d.reserve(polygon3d.geometry.points.size());
233 for (const glm::vec3& point : polygon3d.points) 238 for (const glm::vec3& point : polygon3d.geometry.points)
234 { 239 {
235 points2d.push_back(this->modelToScreenCoordinates(point)); 240 points2d.push_back(this->modelToScreenCoordinates(point));
236 } 241 }
237 painter.drawPolygon({points2d}); 242 painter.drawPolygon(QPolygonF{points2d});
243 }
244 for (const PreviewLayer::Point& point : previewLayer.points)
245 {
246 const geom::CircleF circle = {
247 this->modelToScreenCoordinates(point.location),
248 5.0,
249 };
250 painter.setBrush(point.brush);
251 painter.setPen(point.pen);
252 painter.drawEllipse(geom::inscribe(circle));
238 } 253 }
239 } 254 }
240 } 255 }
241 } 256 }
242 } 257 }

mercurial