Stubbed out mouse events for left up/down/dclick.

This commit is contained in:
Joseph Lenox 2018-05-01 22:32:42 -05:00
parent 76b86c807b
commit a998324962
2 changed files with 24 additions and 2 deletions

View File

@ -18,6 +18,10 @@ Plate2D::Plate2D(wxWindow* parent, const wxSize& size, std::vector<PlaterObject>
this->Bind(wxEVT_PAINT, [=](wxPaintEvent &e) { this->repaint(e); }); this->Bind(wxEVT_PAINT, [=](wxPaintEvent &e) { this->repaint(e); });
this->Bind(wxEVT_MOTION, [=](wxMouseEvent &e) { this->mouse_drag(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) { if (user_drawn_background) {
this->Bind(wxEVT_ERASE_BACKGROUND, [=](wxEraseEvent& e){ }); this->Bind(wxEVT_ERASE_BACKGROUND, [=](wxEraseEvent& e){ });
} }
@ -99,13 +103,28 @@ void Plate2D::repaint(wxPaintEvent& e) {
} }
void Plate2D::mouse_drag(wxMouseEvent& 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()) { if (e.Dragging()) {
Slic3r::Log::info(LogChannel, L"Mouse dragging"); Slic3r::Log::info(LogChannel, L"Mouse dragging");
} else { } 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() { void Plate2D::set_colors() {
this->SetBackgroundColour(settings->color->BACKGROUND255()); this->SetBackgroundColour(settings->color->BACKGROUND255());

View File

@ -36,7 +36,7 @@ public:
// std::function<> on_select_object {}; // std::function<> on_select_object {};
private: private:
std::vector<PlaterObject>& objects; std::vector<PlaterObject>& objects; //< reference to parent vector
std::shared_ptr<Slic3r::Model> model; std::shared_ptr<Slic3r::Model> model;
std::shared_ptr<Slic3r::Config> config; std::shared_ptr<Slic3r::Config> config;
std::shared_ptr<Settings> settings; std::shared_ptr<Settings> settings;
@ -60,6 +60,9 @@ private:
/// Handle mouse-move events /// Handle mouse-move events
void mouse_drag(wxMouseEvent& e); void mouse_drag(wxMouseEvent& e);
void mouse_down(wxMouseEvent& e);
void mouse_up(wxMouseEvent& e);
void mouse_dclick(wxMouseEvent& e);
/// Handle repaint events /// Handle repaint events
void repaint(wxPaintEvent& e); void repaint(wxPaintEvent& e);