From 4fadbbcc2a3f4103c8df0fe0fada8eaa0f7ba15e Mon Sep 17 00:00:00 2001 From: aiongg Date: Sat, 14 Nov 2026 15:49:22 +0000 Subject: [PATCH] panels-w12: repair 1 --- crates/draw/src/ui/brush_presets/picker.rs | 24 ++++++++++++++----- crates/draw/src/ui/transform/session_bar.rs | 1 - .../draw/src/ui/transform/transform_fields.rs | 9 +++++-- crates/draw/tests/it/transform_fields.rs | 3 ++- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/crates/draw/src/ui/brush_presets/picker.rs b/crates/draw/src/ui/brush_presets/picker.rs index a7443ceef..bb781db5d 100644 --- a/crates/draw/src/ui/brush_presets/picker.rs +++ b/crates/draw/src/ui/brush_presets/picker.rs @@ -29,7 +29,6 @@ use crate::ui::brush_settings::{BrushSizeField, TipAngle, TipEllipse}; /// The largest diameter the picker's Size row allows until the app sets its engine's limit. const DEFAULT_MAX_DIAMETER: f64 = 5000.0; - /// The brush values the picker's head edits, given by the app each pass. #[derive(Clone, Copy, Debug, Default, PartialEq)] #[non_exhaustive] @@ -242,8 +241,8 @@ impl Opened { /// - **Presets.** The browser, with the scale slider (0.15 to 2.0) in its footer. The tip alone is a grid with the /// size as each caption; the name or the stroke is a list, with the stroke band while the stroke shows. A click /// picks and keeps the picker open; a double click or Enter picks and closes it. -/// - **Compact form.** [`compact`](Self::compact) leaves out the search row, the gear and the browser and keeps the head; -/// [`rows`](Self::rows) draws the app's rows under it. +/// - **Compact form.** [`compact`](Self::compact) draws the head inline and leaves out the field, the popover, the search +/// row, the gear and the browser; [`rows`](Self::rows) draws the app's rows under it. /// - **Opening.** The closed field, or the app at a point with [`open_at`](Self::open_at) (a right-click on the /// canvas), without the field. With [`resizable`](Self::resizable) the popover's grips resize it and the size is /// saved. @@ -301,8 +300,8 @@ impl<'a, K: Value + Eq + Hash> BrushPresetPicker<'a, K> { } } - /// The compact form: hides the search row, the gear and the browser and keeps the head (Size, - /// Hardness for round tips, the tip widget, the revert and the chip). + /// The compact form: the head (Size, Hardness for round tips, the tip widget) drawn inline, without the field, the + /// popover, the search row, the gear or the browser. pub fn compact(mut self, on: bool) -> Self { self.compact = on; self @@ -459,6 +458,20 @@ impl<'a, K: Value + Eq + Hash> BrushPresetPicker<'a, K> { }); }); }; + if compact { + head(ui, cx); + return BrushPresetPickerOutput { + response: ui.response(), + edit: None, + diameter, + hardness, + tip, + reverted: None, + open: false, + picks: tool_picks.take(), + settings: None, + }; + } let mut picker = PresetPicker::new(words.picker.clone(), current.reborrowed(), rows, Bind::bound(&mut browser)) .field(PickerField::Thumbnail) .caption(env.units().number(values.diameter.round(), 0..=0)) @@ -467,7 +480,6 @@ impl<'a, K: Value + Eq + Hash> BrushPresetPicker<'a, K> { .toolbar(true) .search(before.search) .keep_open() - .browser(!compact) .thumb_range(BRUSH_THUMBS) .footer(PresetFooterOptions::new().new_group(false)) .browser_id(browser_id) diff --git a/crates/draw/src/ui/transform/session_bar.rs b/crates/draw/src/ui/transform/session_bar.rs index 2ce10e43a..d0d9a8247 100644 --- a/crates/draw/src/ui/transform/session_bar.rs +++ b/crates/draw/src/ui/transform/session_bar.rs @@ -124,7 +124,6 @@ impl<'a, W: TransformWarp> TransformBar<'a, W> { self } - /// The Warp phase's group, shown in place of the fields. pub fn warp_fields(mut self, slot: BarSlot<'a>) -> Self { self.warp_fields = Some(slot); diff --git a/crates/draw/src/ui/transform/transform_fields.rs b/crates/draw/src/ui/transform/transform_fields.rs index 2b0357d25..42fdc7dd7 100644 --- a/crates/draw/src/ui/transform/transform_fields.rs +++ b/crates/draw/src/ui/transform/transform_fields.rs @@ -373,7 +373,8 @@ impl Cells<'_> { }; let linked = matches!(self.linked.reborrow().read(cx), Some(Mixed::Same(true))); let relative = self.relative.as_mut().is_some_and(|on| matches!(on.reborrow().read(cx), Some(Mixed::Same(true)))); - let conversion = Conversion { rect: self.start, x: self.x, y: self.y, size: self.size_unit.clone(), linked, document: self.document, relative }; + let conversion = + Conversion { rect: self.start, x: self.x, y: self.y, size: self.size_unit.clone(), linked, document: self.document, relative }; Pass { before, conversion, bases: cx.memory::().clone() } } @@ -473,7 +474,11 @@ impl Cells<'_> { /// The Δ toggle between X and Y; shown when the host gave the `relative` binding. fn relative_toggle(&mut self, ui: &mut Ui) { let Some(bind) = self.relative.as_mut() else { return }; - let toggled = ToggleButton::new(self.words.relative.clone(), bind.reborrowed()).icon(IconId::new("triangle")).icon_only().enabled(self.enabled).show(ui); + let toggled = ToggleButton::new(self.words.relative.clone(), bind.reborrowed()) + .icon(IconId::new("triangle")) + .icon_only() + .enabled(self.enabled) + .show(ui); if let Some(on) = toggled.value().copied() { self.out.relative = Some(on); } diff --git a/crates/draw/tests/it/transform_fields.rs b/crates/draw/tests/it/transform_fields.rs index 1b02fda6e..8e807cba1 100644 --- a/crates/draw/tests/it/transform_fields.rs +++ b/crates/draw/tests/it/transform_fields.rs @@ -150,7 +150,8 @@ fn relative_x_and_y_read_and_move_by_the_reference_points_offset() { assert_eq!(after.state.pivot.y, shifted.pivot.y); // A box flattened to zero height still reads a finite offset. - let flat = BoxState::new([Point::new(0.0, 50.0), Point::new(200.0, 50.0), Point::new(200.0, 50.0), Point::new(0.0, 50.0)], Point::new(100.0, 50.0)); + let flat = + BoxState::new([Point::new(0.0, 50.0), Point::new(200.0, 50.0), Point::new(200.0, 50.0), Point::new(0.0, 50.0)], Point::new(100.0, 50.0)); let mut h = harness_of(TransformRow::new(flat, 0.0), relative()); h.type_into("X position", "5"); let row = h.row();