forked from 1b-agent/opencadstudio-upstream
fix(grid): remove implicit drawing limits
This commit is contained in:
1 parent
cd1378e6b2
commit
ad736e20ea
4 files changed
+26
-4
No files matched your search
+1
-1
@@ -438,7 +438,7 @@ impl DocumentTab {
|
||||
pub(super) fn new_drawing(n: usize) -> Self {
|
||||
let mut scene = Scene::new();
|
||||
linetypes::populate_document(&mut scene.document);
|
||||
// Override acadrust's imperial default limits (12×9) with A4 landscape.
|
||||
// Paper layouts start as A4 landscape.
|
||||
for obj in scene.document.objects.values_mut() {
|
||||
if let acadrust::objects::ObjectType::Layout(l) = obj {
|
||||
if l.name != "Model" {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user