Files
cadcraft/crates/doc
Hamza 9244ffda5d Open a drawing on the view it was saved at (#1602)
A drawing opened fitted to its extents, so one whose extents are dominated by
far-off geometry opened at a view hundreds of times its content: the drawing
was sub-pixel and there was no way to zoom in. Every other reader opens on the
view the file was saved at.

The saved view is read from HEADER (`VIEWCTR`/`VIEWSIZE`) and from the first
`*ACTIVE` VPORT record, which is the newer of the two and wins -- as it already
does for snap and grid spacing. A record that leaves the centre out has no view
to give, so the header pair stands. The extents remain the fallback for a
drawing that stores no view, and that fallback now fits the width too, through
the aspect the record is written with: a drawing 100 wide and 10 tall was given
a view 11 tall, a sliver of it, and a horizontal line got 1e-6.

Writing keeps it, so a read-and-write round trip no longer loses the view.

Rebased onto main, 310 commits on: `open_drawing` and `usable_view` are in
engine/src/session/files.rs, the VPORT reading in io/src/dxf_read/tables.rs,
the HEADER pair list in io/src/dxf_write/header.rs and the VPORT writing in
io/src/dxf_write/layout.rs. The two io tests were already carried by their
hunk, so only the engine one needed placing.
2026-10-28 20:50:16 +05:00
..