fix(grid): remove implicit drawing limits

This commit is contained in:
Hakan Seven committed 2026-07-29 17:21:57 +03:00
1 parent cd1378e6b2
commit ad736e20ea
4 files changed
+26 -4

No files matched your search

+22
View File
@@ -1589,6 +1589,28 @@ fn draw_grid(
}
}
draw_segments(frame, &segments);
// LIMITS bounds the grid, not the UCS axes. Size the axes from the
// visible grid plane so X/Y/Z still span the viewport even when the
// finite grid rectangle is small or currently off-screen.
let axis_extent = samples.iter().fold(0.0_f32, |extent, (_, world)| {
let delta = (*world - grid_origin).as_vec3();
extent
.max(delta.dot(axis1).abs())
.max(delta.dot(axis2).abs())
});
if axis_extent > 0.0 {
let extent = (axis_extent + s) * 1.5;
draw_axes(
frame,
view_rot,
eye,
bounds,
extent.max(10.0),
grid_origin,
(gx, gy, gz),
);
}
return;
}