diff --git a/crates/draw/src/ui/mod.rs b/crates/draw/src/ui/mod.rs index 225c2c675..b5ffece5b 100644 --- a/crates/draw/src/ui/mod.rs +++ b/crates/draw/src/ui/mod.rs @@ -77,10 +77,9 @@ pub use crop::{ CropPresetList, CropPresetListOutput, CropSizeTarget, PerspectiveCropBar, PerspectiveCropBarOutput, PerspectiveCropPass, PerspectiveInput, }; pub use crop::{PerspectiveCropQuad, PerspectiveQuad}; -// PLAN: dl.K55 lists GradientRamp among the items that move to craft-color, but writer note 6 keeps it in this line. pub use gradient::{GradientFill, GradientFillEditor, GradientFillEditorOutput, GradientFillWords, GradientStyle}; pub use gradient::{ - GradientGroup, GradientItem, GradientLine, GradientMap, GradientMapEditor, GradientMapOutput, GradientOverlay, GradientPalette, GradientRamp, + GradientGroup, GradientItem, GradientLine, GradientMap, GradientMapEditor, GradientMapOutput, GradientOverlay, GradientPalette, GradientRef, GradientSwatch, LineGradient, LinePart, }; pub use measure::{MIN_LINE, RulerBar, RulerBarOutput, RulerLine, RulerOverlay, RulerPass, RulerTool, RulerWords, box_distances, ruler_line_form}; diff --git a/crates/draw/src/ui/paint_bar.rs b/crates/draw/src/ui/paint_bar.rs index 4d5f08917..c424bc57d 100644 --- a/crates/draw/src/ui/paint_bar.rs +++ b/crates/draw/src/ui/paint_bar.rs @@ -6,7 +6,7 @@ use craft_behavior::{EditEvent, EditEvents, IconId, Mixed, Value}; use craft_theme::Srgba; use craft_ui::buttons::IconButton; use craft_ui::choice::{Checkbox, Swatch}; -use craft_ui::contract::{Bind, BodyCx, Entry, Gap, LabelKind, Props as _, Remember as _, Show as _, ShowContainer as _, SideLabel, Sizing, Trigger}; +use craft_ui::contract::{Bind, BodyCx, Entry, Gap, LabelKind, PopupKind, Props as _, Remember as _, Show as _, ShowContainer as _, SideLabel, Sizing, Trigger, clicked}; use craft_ui::display::Divider; use craft_ui::form::Field; use craft_ui::layout_components::Row; @@ -70,7 +70,8 @@ pub struct PaintValues { } impl PaintValues { - /// The values of a fresh tool, with `mode` as the blend mode. + /// Starting values for a host with no stored tool options, with `mode` as the blend mode; a host with stored + /// options overwrites every field. pub fn new(mode: M) -> Self { PaintValues { size: 30.0, @@ -348,7 +349,8 @@ impl Pass<'_, M> { fn size(&mut self, ui: &mut Ui, caption: &Label, max: f64, enabled: bool) { let current = self.values.size; let mut events = EditEvents::new(); - ui.add_enabled_ui(enabled, |ui| { + // The size field draws its own caption, so the wrapper only carries the enabled state. + Field::new(caption.clone()).side(SideLabel::new().kind(LabelKind::Hidden)).id_salt("size").sizing(Sizing::Content).enabled(enabled).show(ui, |ui, _| { events = BrushSizeField::new(caption.clone(), Bind::given(current), max).show(ui).edit.events.clone(); }); self.emit(events, |v, size| v.size = size); @@ -422,8 +424,16 @@ impl Pass<'_, M> { /// The gear and its popover of the four smoothing options, enabled while the amount shows above 0 %. fn smoothing_options(&mut self, ui: &mut Ui, cx: &mut BodyCx<'_>, words: &PaintBarWords) { - let gear = IconButton::new(IconId::new("settings")).label(words.smoothing_options.clone()).show(ui).response; let mut open = cx.memory::().0; + let gear = IconButton::new(IconId::new("settings")) + .label(words.smoothing_options.clone()) + .popup(PopupKind::Dialog) + .expanded(open) + .show(ui) + .response; + if clicked(&gear) { + open = !open; + } let active = (self.values.smoothing.amount * 100.0).round() > 0.0; let _ = Popover::new(words.smoothing_options.clone(), Bind::bound(&mut open)).opened_by(&gear).show(ui, |ui, _| { let current = self.values.smoothing; @@ -439,6 +449,7 @@ impl Pass<'_, M> { fn mixer_load(&mut self, ui: &mut Ui, words: &PaintBarWords) { let color = self.values.mixer.load_color; let solid = self.values.mixer.solid_colors_only; + // `Swatch` has no empty face, so a brush with no load shows the mixed face. let swatch = Swatch::new(words.load_swatch.clone(), color.map_or(Mixed::Mixed, Mixed::Same)).show(ui).response; let (mut load, mut clean, mut next_solid) = (false, false, None); let _ = Menu::new(words.load_swatch.clone()).opened_by(&swatch, Trigger::Click).show(ui, |ui, _| {