Fix reselect in flattening

This commit is contained in:
Filip Sykala 2021-12-16 15:57:32 +01:00
parent 9a9c8213cb
commit 553102c4ee
2 changed files with 23 additions and 14 deletions

View File

@ -23,23 +23,32 @@ bool GLGizmoFlatten::on_mouse(const wxMouseEvent &mouse_event)
if (mouse_event.Moving()) {
// only for sure
m_mouse_left_down = false;
if (m_hover_id != -1) m_parent.set_as_dirty();
return false;
}
if (mouse_event.LeftDown() && m_hover_id != -1) {
Selection &selection = m_parent.get_selection();
if (selection.is_single_full_instance()) {
// Rotate the object so the normal points downward:
selection.flattening_rotate(m_planes[m_hover_id].normal);
m_parent.do_rotate(L("Gizmo-Place on Face"));
if (mouse_event.LeftDown()) {
if (m_hover_id != -1) {
m_mouse_left_down = true;
Selection &selection = m_parent.get_selection();
if (selection.is_single_full_instance()) {
// Rotate the object so the normal points downward:
selection.flattening_rotate(m_planes[m_hover_id].normal);
m_parent.do_rotate(L("Gizmo-Place on Face"));
}
return true;
}
m_mouse_left_down = true;
return true;
} else if (m_mouse_left_down && mouse_event.LeftUp()) {
// responsible for mouse left up
// fix: prevent restart gizmo when reselect object
// take responsibility for left up
if (m_parent.get_first_hover_volume_idx() >= 0) m_mouse_left_down = true;
} else if (mouse_event.LeftUp()) {
if (m_mouse_left_down) {
// responsible for mouse left up after selecting plane
m_mouse_left_down = false;
return true;
}
} else if (mouse_event.Leaving()) {
m_mouse_left_down = false;
return true;
}
return false;
}

View File

@ -33,7 +33,7 @@ private:
Vec3d m_first_instance_mirror;
std::vector<PlaneData> m_planes;
bool m_mouse_left_down = false;
bool m_mouse_left_down = false; // for detection left_up of this gizmo
bool m_planes_valid = false;
const ModelObject* m_old_model_object = nullptr;
std::vector<const Transform3d*> instances_matrices;