fix: align white paper fill with entity borders

- paper_entity_extents() computes the bounding box of actual DXF entities
  so the white fill always matches the drawn title-block / frame borders,
  regardless of whether Layout min/max_limits match entity positions
- Falls back to paper_limits() (→ A4 297×210) when layout has no entities
- Removed paper_boundary_wire: the white fill now acts as the visual paper
  edge so the near-white wire (invisible on white) was redundant
- LayoutCreate sets limits to A4 landscape immediately after add_layout()
  to override acadrust's imperial default (12×9)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-04-23 14:21:03 +03:00
commit f63858876d
3 changed files with 50 additions and 37 deletions

View file

@ -68,10 +68,11 @@ impl<'a> canvas::Program<Message> for PaperCanvas<'a> {
const DESK: Color = Color { r: 0.22, g: 0.24, b: 0.28, a: 1.0 };
frame.fill_rectangle(Point::ORIGIN, bounds.size(), DESK);
// ── White paper area ──────────────────────────────────────────────────
if let Some(((px0, py0), (px1, py1))) = self.scene.paper_limits() {
let tl = to_px(px0 as f32, py1 as f32);
let br = to_px(px1 as f32, py0 as f32);
// ── White paper area — use entity extents so the fill aligns with the
// drawn DXF entity borders (title block frame, viewport border, etc.).
if let Some(((px0, py0), (px1, py1))) = self.scene.paper_entity_extents() {
let tl = to_px(px0, py1);
let br = to_px(px1, py0);
let pw = br.x - tl.x;
let ph = br.y - tl.y;
if pw > 0.0 && ph > 0.0 {