mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-27 05:53:13 +00:00
A unit select names its unit once: the number field reads the unit's spellings without a suffix, and the unit lists show the units' names (Units::name)
This commit is contained in:
@@ -80,9 +80,9 @@ fn apply_number(session: &mut Session, events: &EditEvents<Option<f64>>, set: im
|
||||
}
|
||||
}
|
||||
|
||||
/// The entries of a unit list, named by the units' symbols.
|
||||
/// The entries of a unit list, named by the units' names.
|
||||
fn unit_entries(read: &Read<'_>, kinds: &[UnitKind]) -> Vec<Entry<UnitKind>> {
|
||||
kinds.iter().map(|kind| Entry::new(*kind, read.units.symbol(*kind))).collect()
|
||||
kinds.iter().map(|kind| Entry::new(*kind, read.units.name(*kind))).collect()
|
||||
}
|
||||
|
||||
/// Shows the column.
|
||||
|
||||
@@ -333,8 +333,8 @@ fn metadata_row(ui: &mut Ui, words: &SaveForWebWords, options: &mut SaveForWebOp
|
||||
/// Image Size: Width and Height in pixels or percent, the Percent row and the Resample method.
|
||||
fn size_section(ui: &mut Ui, words: &SaveForWebWords, sizing: &SizingWords, units: &Units, link: &mut LinkedSize, resample: &mut Resample) {
|
||||
let kinds = [
|
||||
Entry::new(UnitKind::Pixels, Label::from(units.symbol(UnitKind::Pixels))),
|
||||
Entry::new(UnitKind::Percent, Label::from(units.symbol(UnitKind::Percent))),
|
||||
Entry::new(UnitKind::Pixels, units.name(UnitKind::Pixels)),
|
||||
Entry::new(UnitKind::Percent, units.name(UnitKind::Percent)),
|
||||
];
|
||||
Section::fixed(words.image_size.clone()).id_salt("size").show(ui, |ui, _| {
|
||||
row(ui, &words.width, "width", |ui| {
|
||||
|
||||
@@ -334,7 +334,7 @@ impl Kit {
|
||||
let env = Env::of(ui);
|
||||
let units = env.units();
|
||||
let entries =
|
||||
|kinds: &[UnitKind]| -> Vec<Entry<UnitKind>> { kinds.iter().map(|kind| Entry::new(*kind, Label::from(units.symbol(*kind)))).collect() };
|
||||
|kinds: &[UnitKind]| -> Vec<Entry<UnitKind>> { kinds.iter().map(|kind| Entry::new(*kind, units.name(*kind))).collect() };
|
||||
let lengths = entries(&LENGTH_UNITS);
|
||||
let mut widths = lengths.clone();
|
||||
widths.extend(entries(&[UnitKind::Columns]));
|
||||
|
||||
Reference in New Issue
Block a user