From 6291e436050449f5dc1757b36a77bb2a1ddd528f Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 15 Oct 2026 19:20:32 +0700 Subject: [PATCH] #322: use widgets::note for the vector edit hints The wrapped hint label duplicated widgets::note (a wrapped secondary note inside the panel's side padding); the two hints use it, and the copy and the extra spacing after them go. --- crates/ui-egui/src/vector_panel.rs | 14 +++----------- crates/ui-egui/src/widgets.rs | 6 ------ 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/crates/ui-egui/src/vector_panel.rs b/crates/ui-egui/src/vector_panel.rs index 5a327ecc..e965da35 100644 --- a/crates/ui-egui/src/vector_panel.rs +++ b/crates/ui-egui/src/vector_panel.rs @@ -12,7 +12,7 @@ use crate::FigApp; use crate::i18n::tr; use crate::icons::Icon; use crate::right::{CAP_ART_W, cap_art, join_label, menu_item, menu_item_with, menu_popup, row}; -use crate::widgets::{self, FieldEdit, Lead, PAD}; +use crate::widgets::{self, FieldEdit, Lead}; /// Run a point command from a field: typed values are one step, scrubs one step when released. fn point_field(app: &mut FigApp, cmd: &str, edit: Option, params: impl Fn(f64) -> Value) { @@ -38,11 +38,7 @@ fn width_point(app: &mut FigApp, ui: &mut Ui, doc: &Document, ve: &VectorEdit) { let sel = ve.width_point.and_then(|i| Some((i, *stroke?.profile()?.points.get(i)?))); let Some((i, p)) = sel else { let t = crate::theme::Tokens::get(ui.ctx()); - ui.horizontal(|ui| { - ui.add_space(PAD); - widgets::label_wrapped(ui, tr("Drag the stroke to add a width point"), t.text_secondary); - }); - ui.add_space(8.0); + widgets::note(ui, tr("Drag the stroke to add a width point"), t.text_secondary); return; }; let weight = stroke.map_or(1.0, |s| s.weight); @@ -85,11 +81,7 @@ pub fn points(app: &mut FigApp, ui: &mut Ui, doc: &Document, ve: &VectorEdit) { widgets::section_header(ui, if pts.len() > 1 { tr("Points") } else { tr("Point") }, &[], false); if pts.is_empty() { let t = crate::theme::Tokens::get(ui.ctx()); - ui.horizontal(|ui| { - ui.add_space(PAD); - widgets::label_wrapped(ui, tr("Select points to edit their position, radius and mirroring"), t.text_secondary); - }); - ui.add_space(8.0); + widgets::note(ui, tr("Select points to edit their position, radius and mirroring"), t.text_secondary); return; } let col = widgets::col_width(ui.available_width()); diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index fe9e29cb..db696a1e 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -949,12 +949,6 @@ pub fn label(ui: &mut Ui, text: &str, color: Color32) { ui.label(egui::RichText::new(text).font(regular(11.0)).color(color)); } -/// Text that wraps at the width it is given, so a long hint never widens its panel (a wider -/// panel would move the canvas under the pointer). -pub fn label_wrapped(ui: &mut Ui, text: &str, color: Color32) { - ui.add(egui::Label::new(egui::RichText::new(text).font(regular(11.0)).color(color)).wrap()); -} - /// Text shown in `rect` that turns into an editor on click (or when its editor has focus, e.g. /// after a double-click rename). Returns the new text on Enter / focus loss. pub fn text_field_inline(ui: &mut Ui, id: Id, value: &str, rect: Rect, font: egui::FontId) -> Option {