diff --git a/crates/draw/src/ui/crop/bar.rs b/crates/draw/src/ui/crop/bar.rs index 4f8ac15f4..3b52079ce 100644 --- a/crates/draw/src/ui/crop/bar.rs +++ b/crates/draw/src/ui/crop/bar.rs @@ -2,11 +2,10 @@ use super::bar_words::CropBarWords; use super::menus::{CropOptionsMenu, CropOverlayMenu}; -use super::options::{ - CROP_RATIOS, CROP_SIZES, CropFill, CropLength, CropPresetChoice, CropRatio, CropSettings, CropSizeFields, CropUserPreset, FIELD_MAX, LENGTH_MIN, - RATIO_DECIMALS, RATIO_MAX, RATIO_STEP, ResolutionUnit, -}; +use super::options::{CropFill, CropRatio, CropSettings, CropUserPreset, RATIO_DECIMALS, RATIO_MAX, RATIO_STEP}; +use super::preset_list::CropPresetList; use super::session::CropDocument; +use super::size_cells::{self, SizeLimits}; use craft_behavior::{EditEvent, EditEvents, IconId, NumberCodec}; use craft_ui::buttons::{Button, IconButton, ToggleButton}; use craft_ui::choice::Checkbox; @@ -17,7 +16,7 @@ use craft_ui::display::Divider; use craft_ui::form::Field; use craft_ui::layout_components::Row; use craft_ui::pickers::Select; -use craft_ui::runtime::env::{Env, Label, LengthUnits, UnitKind, Units}; +use craft_ui::runtime::env::{Env, Label, UnitKind, Units}; use craft_ui::runtime::requests::ColorRequest; use craft_ui::text::NumberField; use egui::{Response, Ui}; @@ -62,7 +61,7 @@ pub struct CropBarOutput { pub help: bool, /// Reset was pressed this pass. pub reset: bool, - /// From Selection was picked in the preset list. + /// Selection was picked in the preset list: the app calls `CropTool::take_selection_frame`. pub selection: bool, } @@ -77,16 +76,19 @@ impl Outcome for CropBarOutput { /// The Crop tool's options, shown as children of the app's `Bar::new(label, BarKind::Options)`; ✓ and ⊘ are the bar's /// `commit_cancel`. /// -/// - Order (Photoshop's): the preset list (Ratio, W x H x Resolution, the ratio presets, the size presets, the user's -/// presets, Front Image, a rule, New Crop Preset…, Delete Crop Preset…); the W and H ratio fields (0 to 99,999 with 3 -/// decimals) with the swap button between them, or in W × H × Resolution mode the W, H and Resolution fields with -/// the px/in or px/cm select; Clear; the Angle field; the Straighten toggle (pressed while armed); the overlay menu -/// ([`CropOverlayMenu`]); the gear popover ([`CropOptionsMenu`]); the Delete Cropped Pixels check box; Fill and its -/// select. -/// - W and H keep their lengths with the unit they were entered in ([`CropLength`]); a cleared field is unset. +/// - Order (Photoshop's): the preset list ([`CropPresetList`]: Selection when offered, Ratio, W x H x Resolution, the +/// ratio presets, the size presets, the user's presets, Front Image, a rule, New Crop Preset…, Delete Crop +/// Preset…); the W and H ratio fields (0 to 99,999 with 3 decimals) with the swap button between them, or in +/// W × H × Resolution mode the W, H and Resolution fields with the px/in or px/cm select; Clear; the Angle field; +/// the Straighten toggle (pressed while armed); the overlay menu ([`CropOverlayMenu`]); the gear popover +/// ([`CropOptionsMenu`]); the Delete Cropped Pixels check box; Fill and its select; the help button when a help +/// label is given; Reset. +/// - W and H keep their lengths with the unit they were entered in ([`CropLength`](super::CropLength)); a cleared +/// field is unset. /// - A scrub or a step of a ratio field refits live; Escape puts the ratio back. /// - Delete Crop Preset… is disabled when no user preset is given; New Crop Preset… when [`CropSettings::preset_name`] /// is `None`; Original Ratio and Front Image without a document. +/// - Fill's first entry reads Transparent while Delete Cropped Pixels is off and Background while it is on. /// - **Keyboard and AccessKit:** the list is a select named "Crop ratio" with the chosen entry as its value; the /// fields are named Width, Height, Resolution and Angle; the Straighten toggle has its pressed state; the menus /// open with Enter or Space. @@ -106,21 +108,27 @@ pub struct CropBar<'a> { angle: Option, /// The help button after Fill; `Some` shows it, named by the label. #[prop(into)] - help: Option, + help: Option