mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-12 18:19:13 +08:00
2D Plater: Change cursor to hand cursor when over selectable items. Includes function to check if any instance in a PlaterObject includes a point (makes logic much more readable).
This commit is contained in:
parent
c08d0de7d0
commit
f1ec1f068f
@ -154,14 +154,16 @@ void Plate2D::mouse_drag(wxMouseEvent& e) {
|
|||||||
);
|
);
|
||||||
model_object->update_bounding_box();
|
model_object->update_bounding_box();
|
||||||
this->Refresh();
|
this->Refresh();
|
||||||
|
} else { // moving
|
||||||
|
|
||||||
|
if (std::any_of(this->objects.cbegin(), this->objects.cend(),
|
||||||
|
[=](const Slic3r::GUI::PlaterObject o) { return o.instance_contains(point); })
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this->SetCursor(wxCURSOR_HAND);
|
||||||
} else {
|
} else {
|
||||||
auto cursor = wxSTANDARD_CURSOR;
|
this->SetCursor(*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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,4 +55,11 @@ Slic3r::ExPolygonCollection& PlaterObject::transform_thumbnail(std::shared_ptr<S
|
|||||||
return this->transformed_thumbnail;
|
return this->transformed_thumbnail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PlaterObject::instance_contains(Slic3r::Point point) const {
|
||||||
|
return std::any_of(this->instance_thumbnails.cbegin(), this->instance_thumbnails.cend(),
|
||||||
|
[point](const ExPolygonCollection ep) {
|
||||||
|
return ep.contains(point);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
} } // Namespace Slic3r::GUI
|
} } // Namespace Slic3r::GUI
|
||||||
|
@ -33,6 +33,8 @@ public:
|
|||||||
Slic3r::ExPolygonCollection& transform_thumbnail(const Slic3r::Model model, int obj_idx);
|
Slic3r::ExPolygonCollection& transform_thumbnail(const Slic3r::Model model, int obj_idx);
|
||||||
Slic3r::ExPolygonCollection& transform_thumbnail(const std::shared_ptr<Slic3r::Model> model, int obj_idx);
|
Slic3r::ExPolygonCollection& transform_thumbnail(const std::shared_ptr<Slic3r::Model> model, int obj_idx);
|
||||||
|
|
||||||
|
bool instance_contains(Slic3r::Point point) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const std::string LogChannel {"PlaterObject"};
|
const std::string LogChannel {"PlaterObject"};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user