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 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-12 00:09:05 +03:00
commit 8eeb155bfe

View file

@ -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));
}