From b33b28c076bbc8ec25a271ed1120e82cb20d1ebc Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 12 Sep 2023 10:30:14 +0200 Subject: [PATCH] SPE-1868: Fixed GCodeViewer max bounding box calculation leading to wrong camera near z plane --- src/slic3r/GUI/GCodeViewer.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index 754daa8778..c1e9ae874e 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -830,12 +830,16 @@ public: const BoundingBoxf3& get_paths_bounding_box() const { return m_paths_bounding_box; } const BoundingBoxf3& get_shells_bounding_box() const { return m_shells_bounding_box; } + const BoundingBoxf3& get_max_bounding_box() const { BoundingBoxf3& max_bounding_box = const_cast(m_max_bounding_box); if (!max_bounding_box.defined) { - max_bounding_box = m_shells_bounding_box; - max_bounding_box.merge(m_paths_bounding_box); - max_bounding_box.merge(m_paths_bounding_box.max + m_sequential_view.marker.get_bounding_box().size().z() * Vec3d::UnitZ()); + if (m_shells_bounding_box.defined) + max_bounding_box = m_shells_bounding_box; + if (m_paths_bounding_box.defined) { + max_bounding_box.merge(m_paths_bounding_box); + max_bounding_box.merge(m_paths_bounding_box.max + m_sequential_view.marker.get_bounding_box().size().z() * Vec3d::UnitZ()); + } } return m_max_bounding_box; }