SoftFever 2025-02-19 19:27:22 +08:00 committed by GitHub
commit 55a351d5f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1541,13 +1541,20 @@ void GLCanvas3D::refresh_camera_scene_box()
BoundingBoxf3 GLCanvas3D::volumes_bounding_box(bool current_plate_only) const
{
BoundingBoxf3 bb;
PartPlate *plate = wxGetApp().plater()->get_partplate_list().get_curr_plate();
BoundingBoxf3 expand_part_plate_list_box;
bool is_limit = m_canvas_type != ECanvasType::CanvasAssembleView;
if (is_limit) {
auto plate_list_box = current_plate_only ? wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_bounding_box() :
wxGetApp().plater()->get_partplate_list().get_bounding_box();
auto horizontal_radius = 0.5 * sqrt(std::pow(plate_list_box.min[0] - plate_list_box.max[0], 2) + std::pow(plate_list_box.min[1] - plate_list_box.max[1], 2));
const float scale = 2;
expand_part_plate_list_box.merge(plate_list_box.min - scale * Vec3d(horizontal_radius, horizontal_radius, 0));
expand_part_plate_list_box.merge(plate_list_box.max + scale * Vec3d(horizontal_radius, horizontal_radius, 0));
}
for (const GLVolume *volume : m_volumes.volumes) {
if (!m_apply_zoom_to_volumes_filter || ((volume != nullptr) && volume->zoom_to_volumes)) {
const auto plate_bb = plate->get_bounding_box();
const auto v_bb = volume->transformed_bounding_box();
if (!plate_bb.overlap(v_bb))
if (is_limit && !expand_part_plate_list_box.overlap(v_bb))
continue;
bb.merge(v_bb);
}