SPE-1259 - Fix for sinking objects not placed on top of bed after rotation with Place on face Gizmo

This commit is contained in:
enricoturri1966 2022-07-21 14:16:09 +02:00
parent 5922966eb0
commit 8fbc0b8633
2 changed files with 14 additions and 20 deletions

View File

@ -3896,12 +3896,13 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type)
for (int i = 0; i < static_cast<int>(m_model->objects.size()); ++i) {
const ModelObject* obj = m_model->objects[i];
for (int j = 0; j < static_cast<int>(obj->instances.size()); ++j) {
if (snapshot_type.empty() && m_selection.get_object_idx() == i) {
if (snapshot_type == L("Gizmo-Place on Face") && m_selection.get_object_idx() == i) {
// This means we are flattening this object. In that case pretend
// that it is not sinking (even if it is), so it is placed on bed
// later on (whatever is sinking will be left sinking).
min_zs[{ i, j }] = SINKING_Z_THRESHOLD;
} else
}
else
min_zs[{ i, j }] = obj->instance_bounding_box(j).min.z();
}

View File

@ -43,25 +43,18 @@ bool GLGizmoFlatten::on_mouse(const wxMouseEvent &mouse_event)
}
return true;
}
// 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()) {
}
else if (mouse_event.LeftUp()) {
if (m_mouse_left_down) {
if (m_hover_id == -1)
// no plane hovered
return false;
else {
// responsible for mouse left up after selecting plane
m_mouse_left_down = false;
return true;
}
}
} else if (mouse_event.Leaving()) {
else if (mouse_event.Leaving())
m_mouse_left_down = false;
}
return false;
}