Various gizmos refactoring

This commit is contained in:
Filip Sykala 2023-10-29 23:11:10 +08:00 committed by Noisyfox
parent 30af274d44
commit 9dbb2dfe0d
22 changed files with 292 additions and 451 deletions

View file

@ -117,7 +117,6 @@ Selection::Selection()
, m_type(Empty)
, m_valid(false)
, m_scale_factor(1.0f)
, m_dragging(false)
{
this->set_bounding_boxes_dirty();
}
@ -812,12 +811,11 @@ const BoundingBoxf3& Selection::get_scaled_instance_bounding_box() const
return *m_scaled_instance_bounding_box;
}
void Selection::start_dragging()
void Selection::setup_cache()
{
if (!m_valid)
return;
m_dragging = true;
set_caches();
}
@ -1166,12 +1164,12 @@ void Selection::scale_to_fit_print_volume(const BuildVolume& volume)
type.set_joint();
// apply scale
start_dragging();
setup_cache();
scale(s * Vec3d::Ones(), type);
wxGetApp().plater()->canvas3D()->do_scale(""); // avoid storing another snapshot
// center selection on print bed
start_dragging();
setup_cache();
offset.z() = -get_bounding_box().min.z();
translate(offset);
wxGetApp().plater()->canvas3D()->do_move(""); // avoid storing another snapshot