src/ui/canvas.cpp

changeset 55
cb81ecb5fb23
parent 52
eee644f88e93
child 56
fad4a5dd8dee
equal deleted inserted replaced
54:a4055f67b9c7 55:cb81ecb5fb23
20 this->update(); 20 this->update();
21 } 21 }
22 22
23 void Canvas::mouseMoveEvent(QMouseEvent* event) 23 void Canvas::mouseMoveEvent(QMouseEvent* event)
24 { 24 {
25 #if 0
26 std::optional<glm::vec3> p = this->cameraToGrid(event->pos());
27 if (p.has_value())
28 {
29 this->newStatusText("Position: (%1, %2, %3)"_q.arg(p->x).arg(p->y).arg(p->z));
30 }
31 else
32 {
33 this->newStatusText("Position: <none>"_q);
34 }
35 #else
36 const QPointF originAtCamera = this->worldToCamera({1, 1, 1});
37 this->newStatusText("Origin at (%1, %2), cursor at (%3, %4)"_q.arg(originAtCamera.x()).arg(originAtCamera.y()).arg(event->pos().x()).arg(event->pos().y()));
38 #endif
25 const ldraw::Id id = this->pick(event->pos()); 39 const ldraw::Id id = this->pick(event->pos());
26 this->newStatusText("Selected: %1"_q.arg(id.value));
27 this->highlighted = id; 40 this->highlighted = id;
28 this->totalMouseMove += (event->pos() - this->lastMousePosition).manhattanLength(); 41 this->totalMouseMove += (event->pos() - this->lastMousePosition).manhattanLength();
29 this->lastMousePosition = event->pos(); 42 this->lastMousePosition = event->pos();
30 PartRenderer::mouseMoveEvent(event); 43 PartRenderer::mouseMoveEvent(event);
31 } 44 }

mercurial