mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 04:04:25 +00:00
panels-w13: repair 1
This commit is contained in:
@@ -56,7 +56,8 @@ impl Lengths<'_> {
|
||||
let LengthRow { label, side, value, range, presets } = spec;
|
||||
let points = value.map_or(Mixed::Mixed, |value| Mixed::Same(Some(f64::from(value))));
|
||||
let field = Field::new(label.clone()).side(side).show(ui, |ui, _| {
|
||||
let out = length_field(self.unit, label.clone(), points, range.clone()).presets(presets).scrub_by_label().sizing(Sizing::FillWidth).show(ui);
|
||||
let out =
|
||||
length_field(self.unit, label.clone(), points, range.clone()).presets(presets).scrub_by_label().sizing(Sizing::FillWidth).show(ui);
|
||||
(out.edit.events, out.preset)
|
||||
});
|
||||
field.inner.unwrap_or_default()
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
//! Stories of the Character and Paragraph controls, the Paragraph dialog and its preview.
|
||||
|
||||
#[cfg(feature = "font-picker")]
|
||||
use super::FaceAxes;
|
||||
use super::{
|
||||
BaselinePosition, Caps, CharacterControls, CharacterValues, Kerning, Leading, LineSpacing, ParagraphAlign, ParagraphControls, ParagraphDialog,
|
||||
ParagraphFormat, ParagraphPreview, ParagraphValues, SpacingKind, SpecialIndent, TextAlign,
|
||||
};
|
||||
#[cfg(feature = "font-picker")]
|
||||
use super::FaceAxes;
|
||||
use craft_theme::Rgba;
|
||||
use craft_ui::contract::Show as _;
|
||||
use craft_ui::dialog::{DialogStack, StackDialog as _};
|
||||
|
||||
@@ -323,7 +323,8 @@ impl<'a> TextStyleOptions<'a> {
|
||||
found
|
||||
}),
|
||||
StyleAttribute::Size => include_row(ui, &words.include, attribute, on, |ui| {
|
||||
let row = LengthRow { label: cw.size.clone(), side: text_side(&cw.size), value: c.size, range: SIZE_RANGE, presets: &size_presets };
|
||||
let row =
|
||||
LengthRow { label: cw.size.clone(), side: text_side(&cw.size), value: c.size, range: SIZE_RANGE, presets: &size_presets };
|
||||
let (event, _) = lengths.row(ui, row);
|
||||
character(number_change(event, CharacterChange::Size))
|
||||
}),
|
||||
@@ -363,9 +364,9 @@ impl<'a> TextStyleOptions<'a> {
|
||||
}
|
||||
Vec::new()
|
||||
}),
|
||||
StyleAttribute::FauxBold => {
|
||||
include_row(ui, &words.include, attribute, on, |ui| toggle_field(ui, &cw.faux_bold, "text_bold", c.faux_bold, CharacterChange::FauxBold))
|
||||
}
|
||||
StyleAttribute::FauxBold => include_row(ui, &words.include, attribute, on, |ui| {
|
||||
toggle_field(ui, &cw.faux_bold, "text_bold", c.faux_bold, CharacterChange::FauxBold)
|
||||
}),
|
||||
StyleAttribute::FauxItalic => include_row(ui, &words.include, attribute, on, |ui| {
|
||||
toggle_field(ui, &cw.faux_italic, "text_italic", c.faux_italic, CharacterChange::FauxItalic)
|
||||
}),
|
||||
|
||||
@@ -397,16 +397,16 @@ impl<'a> TextStylesPanel<'a> {
|
||||
None => list,
|
||||
};
|
||||
let shown_rows = list.show_items(ui, &source, &mut |id, _| {
|
||||
let Some(row) = rows.iter().find(|row| row.id == *id) else { return ListRow::new(Label::Empty) };
|
||||
let is_current = target && current == Some(*id);
|
||||
let marked = is_current && overridden;
|
||||
let none = *id == 0 && !paragraph;
|
||||
let name = if marked { words.overridden_name.fill(&[("name", row.name.as_str())]) } else { row.name.clone() };
|
||||
let spoken = if marked { words.overridden_spoken.fill(&[("name", row.name.as_str())]) } else { row.name.clone() };
|
||||
let description = if none { words.no_character_style.as_str().to_owned() } else { tip.clone() };
|
||||
let styled = ListRow::new(name).accessible_name(spoken).description(description).highlight(is_current);
|
||||
if none { styled.ink(RowInk::Dimmed) } else { styled }
|
||||
});
|
||||
let Some(row) = rows.iter().find(|row| row.id == *id) else { return ListRow::new(Label::Empty) };
|
||||
let is_current = target && current == Some(*id);
|
||||
let marked = is_current && overridden;
|
||||
let none = *id == 0 && !paragraph;
|
||||
let name = if marked { words.overridden_name.fill(&[("name", row.name.as_str())]) } else { row.name.clone() };
|
||||
let spoken = if marked { words.overridden_spoken.fill(&[("name", row.name.as_str())]) } else { row.name.clone() };
|
||||
let description = if none { words.no_character_style.as_str().to_owned() } else { tip.clone() };
|
||||
let styled = ListRow::new(name).accessible_name(spoken).description(description).highlight(is_current);
|
||||
if none { styled.ink(RowInk::Dimmed) } else { styled }
|
||||
});
|
||||
let (events, second) = (shown_rows.events, shown_rows.activation_clicks >= 2);
|
||||
|
||||
let pointer = craft_ui::runtime::pointer::frame(ui.ctx());
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
mod editor;
|
||||
mod notes;
|
||||
mod path_text;
|
||||
// PLAN: `mod path_text;` belongs here once tools-w4's `tests/it/path_text.rs` exists. It is not in this tree, so the declaration fails to compile.
|
||||
mod ruler;
|
||||
mod style_options;
|
||||
mod style_panel;
|
||||
|
||||
Reference in New Issue
Block a user