From ecb210cc2fd74140fa4f0dde2353fd6f665e98e1 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 22:51:25 -0500 Subject: [PATCH] Contract stubs: craft-ui-canvas, craft-ui-shell --- crates/ui-canvas/src/canvas/crop/mod.rs | 30 ++++++- crates/ui-canvas/src/canvas/full_window.rs | 2 +- crates/ui-canvas/src/canvas/mod.rs | 11 ++- crates/ui-canvas/src/canvas/navigate/mod.rs | 2 +- .../ui-canvas/src/canvas/navigate/options.rs | 43 +++++++++- crates/ui-canvas/src/canvas/space.rs | 15 ++++ crates/ui-canvas/src/canvas/split/mod.rs | 58 ++++++++++--- crates/ui-canvas/src/canvas_controls/mod.rs | 2 +- .../src/canvas_controls/outline/mod.rs | 14 +++ .../ui-canvas/src/canvas_controls/task_bar.rs | 34 +++++++- crates/ui-shell/src/shell/mod.rs | 5 +- crates/ui-shell/src/shell/recent.rs | 11 ++- crates/ui-shell/src/shell/start.rs | 86 +++++++++++++++++-- crates/ui-shell/src/shell/start/stories.rs | 7 +- 14 files changed, 289 insertions(+), 31 deletions(-) diff --git a/crates/ui-canvas/src/canvas/crop/mod.rs b/crates/ui-canvas/src/canvas/crop/mod.rs index f2a9256ac..01e6f80aa 100644 --- a/crates/ui-canvas/src/canvas/crop/mod.rs +++ b/crates/ui-canvas/src/canvas/crop/mod.rs @@ -171,9 +171,33 @@ pub struct CropOverlay<'a> { /// Nothing is painted and a press anywhere on the canvas draws a new frame. #[prop(flag)] hidden: bool, + /// What a press outside the frame does: turns it, applies the crop, or draws a new frame. + #[prop] + #[allow(dead_code)] // P3(pdf-edit-w4): ED-F8 + outside: CropOutside, + /// The quad the frame is bounded to, drawn as an outline in the guide colour. + #[prop] + #[allow(dead_code)] // P3(pdf-edit-w4): ED-F8 + area: Option<[Point; 4]>, + /// The smallest side a drawn frame keeps. + #[prop(quantity = "document units")] + min_side: f64, report: Report, } +/// What a press outside a crop frame does. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +#[non_exhaustive] +pub enum CropOutside { + /// The press turns the frame. + #[default] + Turn, + /// The press applies the crop. + Apply, + /// The press draws a new frame. + NewFrame, +} + impl<'a> CropOverlay<'a> { /// An overlay named `label` over `crop`. A mixed value shows the whole document. pub fn new(label: impl Into