From 8eeb155bfeca3d9377fa66379864bee0a48e68ab Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 12 Jun 2026 00:09:05 +0300 Subject: [PATCH] fix(zoom): include 3D solid meshes in model-space extents ZOOM EXTENTS / auto-fit derived the drawing bounds from wire AABBs and tessellated key-vertices only. 3D solids (Solid3D/Region/Body) render as meshes with an empty wire path, so they contributed nothing and a drawing containing only solids zoomed to nothing. Fold each mesh's offset-relative XY AABB into the extents on both the wire-cache and tessellate-fallback paths. Co-Authored-By: Claude Opus 4.8 --- src/scene/mod.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/scene/mod.rs b/src/scene/mod.rs index 3f5973a4..c5821a2a 100644 --- a/src/scene/mod.rs +++ b/src/scene/mod.rs @@ -2652,6 +2652,16 @@ impl Scene { any = true; } } + // 3D solids render as meshes, not wires, so fold their + // XY AABBs in too — otherwise ZOOM EXTENTS ignores them. + for set in self.meshes.values() { + let [ax, ay, bx, by] = set.world_aabb; + if ax.is_finite() && bx.is_finite() { + min = min.min(glam::Vec3::new(ax + ox as f32, ay + oy as f32, 0.0)); + max = max.max(glam::Vec3::new(bx + ox as f32, by + oy as f32, 0.0)); + any = true; + } + } return if any { Some((min, max)) } else { None }; } } @@ -2690,6 +2700,15 @@ impl Scene { } } } + // Same mesh inclusion for the tessellate fallback path. + for set in self.meshes.values() { + let [ax, ay, bx, by] = set.world_aabb; + if ax.is_finite() && bx.is_finite() { + min = min.min(glam::Vec3::new(ax + ox as f32, ay + oy as f32, oz)); + max = max.max(glam::Vec3::new(bx + ox as f32, by + oy as f32, oz)); + any = true; + } + } if any { return Some((min, max)); }