mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-29 12:56:47 -06:00
#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.
This commit is contained in:
@@ -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<FieldEdit>, 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());
|
||||
|
||||
@@ -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<String> {
|
||||
|
||||
Reference in New Issue
Block a user