fix(grid): remove implicit drawing limits
This commit is contained in:
parent
cd1378e6b2
commit
ad736e20ea
4 changed files with 26 additions and 4 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
|
@ -78,7 +78,7 @@ checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "acadrust"
|
name = "acadrust"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "git+https://github.com/OpenAEC-Foundation/acadifc.git?rev=a66b0d9#a66b0d994c052e446fd0d6168bef9ec2b2aceed8"
|
source = "git+https://github.com/OpenAEC-Foundation/acadifc.git?rev=5a2069a#5a2069a7abe6b440fbd3bbacb4dfff8555f082c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash 0.8.12",
|
"ahash 0.8.12",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
|
@ -3259,7 +3259,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0b577e2d69827c4740cba2b52efaad1c4cc7c73042860b199710b3575c68438d"
|
checksum = "0b577e2d69827c4740cba2b52efaad1c4cc7c73042860b199710b3575c68438d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytecount",
|
"bytecount",
|
||||||
"memchr 2.8.3",
|
"memchr 1.0.2",
|
||||||
"nom 8.0.0",
|
"nom 8.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ windows-sys = { version = "0.61", features = ["Win32_UI_Shell", "Win32_UI_Window
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
# Track standard DWG object relationships used by the scene integration.
|
# Track standard DWG object relationships used by the scene integration.
|
||||||
acadrust = { git = "https://github.com/OpenAEC-Foundation/acadifc.git", rev = "a66b0d9" }
|
acadrust = { git = "https://github.com/OpenAEC-Foundation/acadifc.git", rev = "5a2069a" }
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
# Native enables the plugin host runtime (out-of-process plugins).
|
# Native enables the plugin host runtime (out-of-process plugins).
|
||||||
|
|
|
||||||
|
|
@ -438,7 +438,7 @@ impl DocumentTab {
|
||||||
pub(super) fn new_drawing(n: usize) -> Self {
|
pub(super) fn new_drawing(n: usize) -> Self {
|
||||||
let mut scene = Scene::new();
|
let mut scene = Scene::new();
|
||||||
linetypes::populate_document(&mut scene.document);
|
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() {
|
for obj in scene.document.objects.values_mut() {
|
||||||
if let acadrust::objects::ObjectType::Layout(l) = obj {
|
if let acadrust::objects::ObjectType::Layout(l) = obj {
|
||||||
if l.name != "Model" {
|
if l.name != "Model" {
|
||||||
|
|
|
||||||
|
|
@ -1589,6 +1589,28 @@ fn draw_grid(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
draw_segments(frame, &segments);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue