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

@ -64,9 +64,21 @@ impl<'a> canvas::Program<Message> for PaperCanvas<'a> {
let mut frame = canvas::Frame::new(renderer, bounds.size());
// ── Background ────────────────────────────────────────────────────────
let [r, g, b, a] = self.scene.paper_bg_color;
frame.fill_rectangle(Point::ORIGIN, bounds.size(), Color { r, g, b, a });
// ── Desk background (area outside the paper sheet) ────────────────────
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);
let pw = br.x - tl.x;
let ph = br.y - tl.y;
if pw > 0.0 && ph > 0.0 {
let [r, g, b, a] = self.scene.paper_bg_color;
frame.fill_rectangle(tl, iced::Size::new(pw, ph), Color { r, g, b, a });
}
}
// ── Wipeout fills (rendered before wires, cover background) ──────────
for hatch in &self.scene.paper_canvas_wipeouts() {