mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 11:17:51 -06:00
Refactoring of GLSelectionRectangle
This commit is contained in:
parent
d79a2b8d2d
commit
9d070410c2
3 changed files with 111 additions and 110 deletions
|
@ -100,7 +100,7 @@ void GLGizmoSlaSupports::on_render(const Selection& selection) const
|
|||
if (m_quadric != nullptr && selection.is_from_single_instance())
|
||||
render_points(selection, false);
|
||||
|
||||
m_selection_rectangle.render();
|
||||
m_selection_rectangle.render(m_parent);
|
||||
render_clipping_plane(selection);
|
||||
|
||||
glsafe(::glDisable(GL_BLEND));
|
||||
|
@ -467,9 +467,7 @@ bool GLGizmoSlaSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
|||
if (action == SLAGizmoEventType::LeftDown && (shift_down || alt_down || control_down)) {
|
||||
if (m_hover_id == -1) {
|
||||
if (shift_down || alt_down) {
|
||||
Size size = m_parent.get_canvas_size();
|
||||
m_selection_rectangle.start_dragging(mouse_position, size.get_width(), size.get_height(),
|
||||
shift_down ? GLSelectionRectangle::SlaSelect : GLSelectionRectangle::SlaDeselect);
|
||||
m_selection_rectangle.start_dragging(mouse_position, shift_down ? GLSelectionRectangle::Select : GLSelectionRectangle::Deselect);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -512,7 +510,7 @@ bool GLGizmoSlaSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
|||
// left up with selection rectangle - select points inside the rectangle:
|
||||
if ((action == SLAGizmoEventType::LeftUp || action == SLAGizmoEventType::ShiftUp || action == SLAGizmoEventType::AltUp) && m_selection_rectangle.is_dragging()) {
|
||||
// Is this a selection or deselection rectangle?
|
||||
GLSelectionRectangle::EState rectangle_status = m_selection_rectangle.get_status();
|
||||
GLSelectionRectangle::EState rectangle_status = m_selection_rectangle.get_state();
|
||||
|
||||
// First collect positions of all the points in world coordinates.
|
||||
const Transform3d& instance_matrix = m_model_object->instances[m_active_instance]->get_transformation().get_matrix();
|
||||
|
@ -524,7 +522,7 @@ bool GLGizmoSlaSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
|||
}
|
||||
// Now ask the rectangle which of the points are inside.
|
||||
const Camera& camera = m_parent.get_camera();
|
||||
std::vector<unsigned int> selected_idxs = m_selection_rectangle.end_dragging(camera, points);
|
||||
std::vector<unsigned int> selected_idxs = m_selection_rectangle.stop_dragging(m_parent, points);
|
||||
|
||||
// we'll recover current look direction (in world coords) and transform it to model coords.
|
||||
const Selection& selection = m_parent.get_selection();
|
||||
|
@ -577,7 +575,7 @@ bool GLGizmoSlaSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
|||
}
|
||||
|
||||
if (!is_obscured) {
|
||||
if (rectangle_status == GLSelectionRectangle::SlaDeselect)
|
||||
if (rectangle_status == GLSelectionRectangle::Deselect)
|
||||
unselect_point(i);
|
||||
else
|
||||
select_point(i);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue