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 SevenandClaude Sonnet 4.6 committed 2026-04-23 14:05:07 +03:00
1 parent fcc29de469
commit 0a291c877b
6 files changed
+23 -56

No files matched your search

+2 -13
View File
@@ -9,9 +9,6 @@ use iced::{mouse, Event, Rectangle};
pub enum ViewportPaneMode {
/// Full model space — fills whatever bounds Iced assigns.
Model,
/// Paper-space entities plus model content projected through viewports.
/// Used for the full paper canvas (single widget, no per-viewport widgets).
PaperSheet,
/// Model-space content rendered through a specific viewport's 3-D camera.
///
/// NOTE: Currently unused because Iced 0.14 batches all shader `prepare()`
@@ -35,11 +32,6 @@ impl<'a> ViewportPane<'a> {
Self { scene, mode: ViewportPaneMode::Model }
}
/// Paper-sheet layer: paper-space entities rendered with the paper camera.
pub fn paper_sheet(scene: &'a Scene) -> Self {
Self { scene, mode: ViewportPaneMode::PaperSheet }
}
/// One paper-space viewport: model content rendered through its own camera.
/// See [`ViewportPaneMode::Paper`] for why this is currently unused.
#[allow(dead_code)]
@@ -116,9 +108,6 @@ impl<'a, Msg: std::fmt::Debug + Clone> shader::Program<Msg> for ViewportPane<'a>
ViewportPaneMode::Model => {
self.scene.build_primitive(state.hover_region, bounds)
}
ViewportPaneMode::PaperSheet => {
self.scene.build_paper_sheet_primitive(state.hover_region, bounds)
}
ViewportPaneMode::Paper { handle } => {
self.scene.build_viewport_primitive(*handle, state.hover_region, bounds)
}
@@ -133,7 +122,7 @@ impl<'a, Msg: std::fmt::Debug + Clone> shader::Program<Msg> for ViewportPane<'a>
cursor: mouse::Cursor,
) -> Option<iced::widget::Action<Msg>> {
// ViewCube hover only makes sense in the full model-space view.
if matches!(self.mode, ViewportPaneMode::Model | ViewportPaneMode::PaperSheet) {
if matches!(self.mode, ViewportPaneMode::Model) {
self.scene.update_viewcube_state(state, bounds, cursor);
}
let _ = event;
@@ -146,7 +135,7 @@ impl<'a, Msg: std::fmt::Debug + Clone> shader::Program<Msg> for ViewportPane<'a>
_b: Rectangle,
_c: mouse::Cursor,
) -> mouse::Interaction {
if matches!(self.mode, ViewportPaneMode::Model | ViewportPaneMode::PaperSheet) {
if matches!(self.mode, ViewportPaneMode::Model) {
self.scene.viewcube_mouse_interaction(state)
} else {
mouse::Interaction::default()