diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp index 11f863f93..fb0b172a9 100644 --- a/src/GUI/Plater/Plate2D.cpp +++ b/src/GUI/Plater/Plate2D.cpp @@ -18,6 +18,10 @@ Plate2D::Plate2D(wxWindow* parent, const wxSize& size, std::vector this->Bind(wxEVT_PAINT, [=](wxPaintEvent &e) { this->repaint(e); }); this->Bind(wxEVT_MOTION, [=](wxMouseEvent &e) { this->mouse_drag(e); }); + this->Bind(wxEVT_LEFT_DOWN, [=](wxMouseEvent &e) { this->mouse_down(e); }); + this->Bind(wxEVT_LEFT_UP, [=](wxMouseEvent &e) { this->mouse_up(e); }); + this->Bind(wxEVT_LEFT_DCLICK, [=](wxMouseEvent &e) { this->mouse_dclick(e); }); + if (user_drawn_background) { this->Bind(wxEVT_ERASE_BACKGROUND, [=](wxEraseEvent& e){ }); } @@ -99,13 +103,28 @@ void Plate2D::repaint(wxPaintEvent& e) { } void Plate2D::mouse_drag(wxMouseEvent& e) { + const auto pos {e.GetPosition()}; + const auto& point {this->point_to_model_units(e.GetPosition())}; if (e.Dragging()) { Slic3r::Log::info(LogChannel, L"Mouse dragging"); } else { - Slic3r::Log::info(LogChannel, L"Mouse moving"); + auto cursor = wxSTANDARD_CURSOR; + /* + if (find_first_of(this->objects.begin(), this->objects.end(); [=](const PlaterObject& o) { return o.contour->contains_point(point);} ) == this->object.end()) { + cursor = wxCursor(wxCURSOR_HAND); + } + */ + this->SetCursor(*cursor); } } +void Plate2D::mouse_down(wxMouseEvent& e) { +} +void Plate2D::mouse_up(wxMouseEvent& e) { +} +void Plate2D::mouse_dclick(wxMouseEvent& e) { +} + void Plate2D::set_colors() { this->SetBackgroundColour(settings->color->BACKGROUND255()); diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 8bab87b7a..61c097422 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -36,7 +36,7 @@ public: // std::function<> on_select_object {}; private: - std::vector& objects; + std::vector& objects; //< reference to parent vector std::shared_ptr model; std::shared_ptr config; std::shared_ptr settings; @@ -60,6 +60,9 @@ private: /// Handle mouse-move events void mouse_drag(wxMouseEvent& e); + void mouse_down(wxMouseEvent& e); + void mouse_up(wxMouseEvent& e); + void mouse_dclick(wxMouseEvent& e); /// Handle repaint events void repaint(wxPaintEvent& e);