From 2a5b738e5f0d6a12423a584cccff2ec32c25e792 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sat, 21 Nov 2026 21:55:00 +0700 Subject: [PATCH] draw: one FieldArrangement, Select value bound, named colours per run --- crates/draw/src/ui/slice/dialogs.rs | 17 ++++++++------- .../draw/src/ui/transform/transform_fields.rs | 21 ------------------- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/crates/draw/src/ui/slice/dialogs.rs b/crates/draw/src/ui/slice/dialogs.rs index 1e10dacee..53955e7b5 100644 --- a/crates/draw/src/ui/slice/dialogs.rs +++ b/crates/draw/src/ui/slice/dialogs.rs @@ -2,6 +2,7 @@ //! what the fields mean at export is the app's. use super::SliceWords; +use craft_behavior::Value; use craft_color_ui::ui::{ChosenColor, ColorChoice, NamedColor}; use craft_theme::Srgba; use craft_ui::choice::{Checkbox, Radio, RadioGroup}; @@ -170,7 +171,7 @@ fn text_row(ui: &mut Ui, label: &Label, value: &mut String) { } /// A labelled `Select` over `entries`. -fn select_row(ui: &mut Ui, label: &Label, value: &mut T, entries: &[Entry]) { +fn select_row(ui: &mut Ui, label: &Label, value: &mut T, entries: &[Entry]) { Field::new(label.clone()).show(ui, |ui, _| { if let Some(picked) = Select::new(label.clone(), Bind::given(*value), entries).show(ui).value().copied() { *value = picked; @@ -371,14 +372,14 @@ impl StackDialog for SliceOptionsDialog { SliceBackground::Color(color) if chosen == ChosenColor::Custom => Some(color), _ => None, }; - let named = SliceBackground::NAMED.iter().zip(background_labels).map(|((id, background), label)| { - let swatch = match background { - SliceBackground::Color(color) => Some(*color), - _ => None, - }; - NamedColor::new(*id, label.clone(), swatch) - }); Field::new(words.background.clone()).show(ui, |ui, _| { + let named = SliceBackground::NAMED.iter().zip(background_labels).map(|((id, background), label)| { + let swatch = match background { + SliceBackground::Color(color) => Some(*color), + _ => None, + }; + NamedColor::new(*id, label.clone(), swatch) + }); let picked = ColorChoice::new(words.background.clone(), &chosen).named(named).custom(custom).show(ui); if let Some(ChosenColor::Named(id)) = &picked.chosen && let Some(background) = SliceBackground::named(id) diff --git a/crates/draw/src/ui/transform/transform_fields.rs b/crates/draw/src/ui/transform/transform_fields.rs index d2a8b2dba..001566120 100644 --- a/crates/draw/src/ui/transform/transform_fields.rs +++ b/crates/draw/src/ui/transform/transform_fields.rs @@ -246,19 +246,6 @@ pub struct TransformFields<'a> { enabled: bool, relative: Option>, document: Option, - #[allow(dead_code)] // P3(object-panels-w1): op.F12 - arrangement: FieldArrangement, -} - -/// Which fields the strip lists first. -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] -#[non_exhaustive] -pub enum FieldArrangement { - /// Width and height before X and Y. - #[default] - SizeFirst, - /// X and Y before width and height. - PositionFirst, } impl<'a> TransformFields<'a> { @@ -281,17 +268,9 @@ impl<'a> TransformFields<'a> { enabled: true, relative: None, document: None, - arrangement: FieldArrangement::default(), } } - /// Which fields come first: the size (default) or the position. - #[must_use] - pub fn arrangement(mut self, arrangement: FieldArrangement) -> Self { - self.arrangement = arrangement; - self - } - /// The rulers X and Y read from: absolute X and Y are measured from the rulers' zero in their units (pixels from the /// origin by default); relative X and Y ignore the zero. #[must_use]