feat: A4 landscape default paper, white paper area on dark desk

- paper_limits() falls back to A4 landscape (297×210mm) even when no
  Layout object exists in the document
- paper_bg_color default changed to white [1,1,1,1] (paper surface color)
- PaperCanvas::draw() fills canvas with dark desk color first, then draws
  the paper area rectangle in paper_bg_color so the sheet is clearly
  visible against the desk background
- view.rs container background uses the fixed desk color instead of
  paper_bg_color so it no longer conflicts with the paper-surface color
- BACKGROUND RESET for paper space now resets to white instead of dark gray
- Removed unused PaperSheet variant, paper_sheet() constructor,
  build_paper_sheet_primitive() and associated match arms (dead code
  after 2D canvas replacement)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-04-23 14:05:07 +03:00
commit 0a291c877b
6 changed files with 23 additions and 56 deletions

View file

@ -95,7 +95,7 @@ impl Scene {
images: HashMap::new(),
active_viewport: None,
bg_color: [0.11, 0.11, 0.11, 1.0],
paper_bg_color: [0.22, 0.24, 0.28, 1.0],
paper_bg_color: [1.0, 1.0, 1.0, 1.0],
}
}
@ -201,11 +201,9 @@ impl Scene {
if let ObjectType::Layout(l) = obj {
if l.name == self.current_layout {
let (min, max) = (l.min_limits, l.max_limits);
// Guard against degenerate limits.
let w = (max.0 - min.0).abs();
let h = (max.1 - min.1).abs();
if w < 1e-6 || h < 1e-6 {
// Default to A4 landscape (mm).
return Some(((0.0, 0.0), (297.0, 210.0)));
}
return Some((min, max));
@ -213,6 +211,8 @@ impl Scene {
}
None
})
// No Layout object found for the current layout — default to A4 landscape.
.or(Some(((0.0, 0.0), (297.0, 210.0))))
}
/// Scale of the first user viewport (id > 1) in the current paper layout,