mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 11:38:08 +00:00
Controls that show their own text keep their name in a labelled row (output path link, preset buttons)
This commit is contained in:
@@ -111,7 +111,8 @@ impl<'a> OutputPathRow<'a> {
|
||||
editing = match std::mem::take(&mut editing) {
|
||||
Editing::Off => {
|
||||
let shown = if current.is_empty() { words.browse.clone() } else { Label::from(current.clone()) };
|
||||
let link = Link::new(shown).wrap(Wrap::ElidePath).tooltip(words.edit_template.clone()).id_salt("file").show(ui);
|
||||
let link =
|
||||
Link::new(shown).wrap(Wrap::ElidePath).tooltip(words.edit_template.clone()).keeps_name(true).id_salt("file").show(ui);
|
||||
if !clicked(&link) {
|
||||
Editing::Off
|
||||
} else if link.mods.alt {
|
||||
|
||||
@@ -299,11 +299,11 @@ impl<'a, K: Value + Eq + Hash + 'static> NamedPresetRow<'a, K> {
|
||||
NamedPresetStyle::Buttons => {
|
||||
for command in files.map(PresetFiles::commands).unwrap_or_default() {
|
||||
let enabled = files.is_some_and(|files| files.enabled(command, held.as_ref()));
|
||||
if clicked(&Button::new(Label::Empty).command(command).enabled(enabled).show(ui)) {
|
||||
if clicked(&Button::new(Label::Empty).command(command).keeps_name(true).enabled(enabled).show(ui)) {
|
||||
asked.push(Ask::File(command));
|
||||
}
|
||||
}
|
||||
let _ = Button::new(Label::Empty).command(NamedPresetCommands::New).show(ui);
|
||||
let _ = Button::new(Label::Empty).command(NamedPresetCommands::New).keeps_name(true).show(ui);
|
||||
if let Some(field) = &field {
|
||||
let _ = Menu::new(words.more.clone()).opened_by(field, Trigger::Context).show(ui, |ui, _| {
|
||||
let _ = MenuItem::command(NamedPresetCommands::Rename).show(ui);
|
||||
|
||||
@@ -63,7 +63,7 @@ fn a_side_label_stays_on_the_first_line_of_its_control() {
|
||||
let fixture = settled_in(|ui| {
|
||||
Field::new("Light theme").show(ui, |ui, _| {
|
||||
Stack::new().show(ui, |ui, _| {
|
||||
Swatch::new("Light", GREY).show(ui);
|
||||
Swatch::new("Light", GREY).keeps_name(true).show(ui);
|
||||
Text::new("Active").show(ui);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user