cargo fmt

This commit is contained in:
aiongg
2026-11-16 18:29:58 +00:00
parent 7e7e86e09c
commit 9d61d87e46
20 changed files with 146 additions and 160 deletions
+3 -1
View File
@@ -144,7 +144,9 @@ impl<'a> ColorReadout<'a> {
events.clear();
channel_edits.clear();
let hex = Field::new(words.hex.clone()).side(HexField::hash_label()).sizing(Sizing::Content);
if let Some(out) = hex.show(ui, |ui, _| TextField::hex(words.hex.as_str().to_owned(), Bind::given(held)).sizing(Sizing::Content).show(ui)).inner {
if let Some(out) =
hex.show(ui, |ui, _| TextField::hex(words.hex.as_str().to_owned(), Bind::given(held)).sizing(Sizing::Content).show(ui)).inner
{
events.extend(out.events);
}
Row::new().show(ui, |ui, _| {
+22 -20
View File
@@ -4,8 +4,8 @@ use std::cell::RefCell;
use std::sync::Arc;
use craft_behavior::{EditEvent, EditEvents, IconId, Mixed, Value};
use craft_theme::Srgba;
use craft_theme::ControlSize;
use craft_theme::Srgba;
use craft_ui::buttons::{IconButton, ToggleButton};
use craft_ui::choice::{Checkbox, Swatch};
use craft_ui::contract::{
@@ -349,7 +349,12 @@ impl<M: Value> Pass<'_, M> {
/// A pen toggle over a flag: an icon button that stays pressed while on, named `caption`; a click is one `Set`.
fn toggle(&mut self, ui: &mut Ui, icon: &'static str, caption: &Label, enabled: bool, current: bool, set: fn(&mut PaintValues<M>, bool)) {
let shown = ToggleButton::new(caption.clone(), Bind::given(current)).icon(IconId::new(icon)).icon_only().size(ControlSize::Md).enabled(enabled).show(ui);
let shown = ToggleButton::new(caption.clone(), Bind::given(current))
.icon(IconId::new(icon))
.icon_only()
.size(ControlSize::Md)
.enabled(enabled)
.show(ui);
if let Some(next) = shown.value().copied() {
self.set_with(caption, |v| set(v, next));
}
@@ -360,24 +365,21 @@ impl<M: Value> Pass<'_, M> {
// The body may run more than once in a pass and only the run that reads the input reports its events, so every
// run's events and alert are collected.
let collected: RefCell<(EditEvents<Option<f64>>, Option<RangeAlert>)> = RefCell::new((EditEvents::new(), None));
let _ = Field::new(caption.clone()).side(SideLabel::new().scrub(true)).id_salt(salt).enabled(enabled).show(
ui,
|ui, _| {
let field = NumberField::new(caption.clone(), Bind::given(Some(current * 100.0)))
.unit_kind(UnitKind::Percent)
.range(0.0..=100.0)
.commit_decimals(0)
.scrub_by_label()
.show(ui);
let mut sink = collected.borrow_mut();
for event in field.edit.events.clone() {
sink.0.push(event);
}
if field.out_of_range.is_some() {
sink.1 = field.out_of_range;
}
},
);
let _ = Field::new(caption.clone()).side(SideLabel::new().scrub(true)).id_salt(salt).enabled(enabled).show(ui, |ui, _| {
let field = NumberField::new(caption.clone(), Bind::given(Some(current * 100.0)))
.unit_kind(UnitKind::Percent)
.range(0.0..=100.0)
.commit_decimals(0)
.scrub_by_label()
.show(ui);
let mut sink = collected.borrow_mut();
for event in field.edit.events.clone() {
sink.0.push(event);
}
if field.out_of_range.is_some() {
sink.1 = field.out_of_range;
}
});
let (events, alert) = collected.into_inner();
if alert.is_some() {
self.out_of_range = alert;
+4 -12
View File
@@ -122,15 +122,11 @@ impl<'a> ShapeBar<'a> {
let check = Checkbox::new(Bind::given(fill_on)).label(words.fill.clone()).show(ui).events;
pass.events.extend(check.map(ShapeChange::FillOn));
let hidden = SideLabel::new().kind(LabelKind::Hidden);
let fill = Field::new(words.fill_color.clone())
.id_salt("fill")
.side(hidden)
.show(ui, |ui, _| pass.chip(ui, ShapePaint::Fill));
let fill = Field::new(words.fill_color.clone()).id_salt("fill").side(hidden).show(ui, |ui, _| pass.chip(ui, ShapePaint::Fill));
if let Some(out) = fill.inner {
pass.take_chip(ShapePaint::Fill, out);
}
let stroke =
Field::new(words.stroke.clone()).id_salt("stroke").show(ui, |ui, _| pass.chip(ui, ShapePaint::Stroke));
let stroke = Field::new(words.stroke.clone()).id_salt("stroke").show(ui, |ui, _| pass.chip(ui, ShapePaint::Stroke));
if let Some(out) = stroke.inner {
pass.take_chip(ShapePaint::Stroke, out);
}
@@ -160,12 +156,8 @@ impl<'a> ShapeBar<'a> {
if let Some((cell, change)) = cell {
Divider::vertical().show(ui);
let side = SideLabel::new().scrub(true);
let (events, alert) = Field::new(cell.caption.clone())
.id_salt(cell.key)
.side(side)
.show(ui, |ui, _| cell.show(ui))
.inner
.unwrap_or_default();
let (events, alert) =
Field::new(cell.caption.clone()).id_salt(cell.key).side(side).show(ui, |ui, _| cell.show(ui)).inner.unwrap_or_default();
pass.events.extend(events.map(change));
pass.alert(alert);
}
+69 -68
View File
@@ -355,78 +355,79 @@ impl<'a> TextStylesPanel<'a> {
}
};
let shown = Panel::new(label.clone()).pad(Pad::None).collection_body().command_scope(TextStyleCommand::SCOPE).footer(footer).show(ui, |ui, cx| {
let before = cx.memory::<Facts>().clone();
while let Some((command, _)) = cx.take_command::<TextStyleCommand>() {
if let Some(found) = before.action(command) {
action.set(Some(found));
}
}
let held = selection.reborrow().read(cx).and_then(|held| held.same().cloned()).unwrap_or_default();
let facts = Facts { paragraph, target, overridden, current, picked: held.lead.or(current), selected: held.items.clone() };
for command in [
TextStyleCommand::ClearOverride,
TextStyleCommand::Redefine,
TextStyleCommand::New,
TextStyleCommand::Duplicate,
TextStyleCommand::Delete,
TextStyleCommand::Options,
TextStyleCommand::SelectUnused,
] {
cx.publish(command, CommandState::new().enabled(facts.action(command).is_some()));
}
*cx.memory::<Facts>() = facts;
let source = keyed(rows, |row: &TextStyleRow| row.id);
let mode = if highlighting { SelectMode::Multi } else { SelectMode::Single };
let list = List::new(label.clone())
.id(list_id)
.select(mode)
.activate(ActivateOn::Click)
.allow_empty(true)
.deletable(true)
.max_rows(8)
.can_drag(move |_| highlighting)
.drag_payload(|drag: &ListDrag<u64>| Some(drag.clone()))
.selection(selection.reborrowed());
let list = match &empty {
Some(text) => list.empty(text.clone()),
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 (events, second) = (shown_rows.events, shown_rows.activation_clicks >= 2);
let pointer = craft_ui::runtime::pointer::frame(ui.ctx());
let alt = pointer.mods.alt;
let plain = !pointer.mods.shift && !pointer.mods.cmd;
for event in events {
match event {
CollectionEvent::Activate(id) if second && (id != 0 || paragraph) => action.set(Some(TextStyleAction::Options(id))),
CollectionEvent::Activate(id) if target && (paragraph || text_selected) && plain => {
action.set(Some(TextStyleAction::apply(id, alt)));
let shown =
Panel::new(label.clone()).pad(Pad::None).collection_body().command_scope(TextStyleCommand::SCOPE).footer(footer).show(ui, |ui, cx| {
let before = cx.memory::<Facts>().clone();
while let Some((command, _)) = cx.take_command::<TextStyleCommand>() {
if let Some(found) = before.action(command) {
action.set(Some(found));
}
// A character style at a bare caret has nothing to apply to: the attempt warns instead.
CollectionEvent::Activate(_) if target && !paragraph && !text_selected && plain => hint.set(true),
CollectionEvent::Delete(keys) if keys.len() > 1 => action.set(Some(TextStyleAction::DeleteHighlighted)),
CollectionEvent::Delete(keys) => {
if let Some(id) = keys.first().copied().filter(|id| *id != 0) {
action.set(Some(TextStyleAction::Delete(id)));
}
let held = selection.reborrow().read(cx).and_then(|held| held.same().cloned()).unwrap_or_default();
let facts = Facts { paragraph, target, overridden, current, picked: held.lead.or(current), selected: held.items.clone() };
for command in [
TextStyleCommand::ClearOverride,
TextStyleCommand::Redefine,
TextStyleCommand::New,
TextStyleCommand::Duplicate,
TextStyleCommand::Delete,
TextStyleCommand::Options,
TextStyleCommand::SelectUnused,
] {
cx.publish(command, CommandState::new().enabled(facts.action(command).is_some()));
}
*cx.memory::<Facts>() = facts;
let source = keyed(rows, |row: &TextStyleRow| row.id);
let mode = if highlighting { SelectMode::Multi } else { SelectMode::Single };
let list = List::new(label.clone())
.id(list_id)
.select(mode)
.activate(ActivateOn::Click)
.allow_empty(true)
.deletable(true)
.max_rows(8)
.can_drag(move |_| highlighting)
.drag_payload(|drag: &ListDrag<u64>| Some(drag.clone()))
.selection(selection.reborrowed());
let list = match &empty {
Some(text) => list.empty(text.clone()),
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 (events, second) = (shown_rows.events, shown_rows.activation_clicks >= 2);
let pointer = craft_ui::runtime::pointer::frame(ui.ctx());
let alt = pointer.mods.alt;
let plain = !pointer.mods.shift && !pointer.mods.cmd;
for event in events {
match event {
CollectionEvent::Activate(id) if second && (id != 0 || paragraph) => action.set(Some(TextStyleAction::Options(id))),
CollectionEvent::Activate(id) if target && (paragraph || text_selected) && plain => {
action.set(Some(TextStyleAction::apply(id, alt)));
}
// A character style at a bare caret has nothing to apply to: the attempt warns instead.
CollectionEvent::Activate(_) if target && !paragraph && !text_selected && plain => hint.set(true),
CollectionEvent::Delete(keys) if keys.len() > 1 => action.set(Some(TextStyleAction::DeleteHighlighted)),
CollectionEvent::Delete(keys) => {
if let Some(id) = keys.first().copied().filter(|id| *id != 0) {
action.set(Some(TextStyleAction::Delete(id)));
}
}
_ => {}
}
_ => {}
}
}
});
});
TextStylesPanelOutput {
response: shown.output.response,
action: action.get(),
+5 -4
View File
@@ -1196,10 +1196,11 @@ fn row_line(ctx: &egui::Context, sizing: bool, id: Id, shared: Option<f32>) -> O
/// with its container's regions already in it: what the container's end region sets its children on, so the end
/// content meets the members' line as the members meet each other. `None` for any other body.
pub(crate) fn members_line(ctx: &egui::Context, body: Id) -> Option<RowLine> {
layout_memory::measured(ctx, sub(body, "line"))
.map(|found| found.took)
.filter(|took| took.y > 0.0)
.map(|took| RowLine { body, centre: Some(took.x), height: Some(took.y) })
layout_memory::measured(ctx, sub(body, "line")).map(|found| found.took).filter(|took| took.y > 0.0).map(|took| RowLine {
body,
centre: Some(took.x),
height: Some(took.y),
})
}
/// The line the unwrapped `Row` body `body` sets its children on: its own (`centre`, `height`), or the line `shared`
+1 -2
View File
@@ -3,8 +3,7 @@
use super::key::{EnvKey, Ink};
use super::look::{DataColor, FocusLook, StyleColor, SurfaceKind, SurfaceLook, TrackLook};
use super::paint::{
HandleLook, MarkerLook, ResetMarkLook, RuleKind, RuleLook, ScrollBarLook, handle_look, marker_look, reset_mark_look, rule_look,
scroll_bar_look,
HandleLook, MarkerLook, ResetMarkLook, RuleKind, RuleLook, ScrollBarLook, handle_look, marker_look, reset_mark_look, rule_look, scroll_bar_look,
};
use super::surface::{SurfaceStyle, surface_style};
use super::tokens::UiTokens;
+1 -3
View File
@@ -25,9 +25,7 @@ pub use cx::{GlyphRole, StyleCx, VariantParts};
pub use key::{EnvKey, Ink, StyleKey};
pub(crate) use look::StyleView;
pub use look::{ComponentStyle, Corners, DataColor, FocusLook, IconLook, StyleColor, SurfaceKind, SurfaceLook, TextLook, TrackLook};
pub use paint::{
HandleLook, MarkerLook, ResetMarkLook, ResizeLineLook, RuleKind, RuleLook, RuleWidth, ScrollBarLook, resize_line_look,
};
pub use paint::{HandleLook, MarkerLook, ResetMarkLook, ResizeLineLook, RuleKind, RuleLook, RuleWidth, ScrollBarLook, resize_line_look};
pub(crate) use paint::{min_thumb, scroll_bar_look};
pub use replacements::{DuplicateStyle, StyleReplacements};
pub use span::Span;
-1
View File
@@ -37,4 +37,3 @@ pub use serde_fields::{serde_fields, set_serde_field};
pub use stack::{DialogId, DialogStack, dialog_id};
pub use unsaved::{UnsavedAnswer, UnsavedChangesDialog, UnsavedChangesOutput};
pub use words::DialogWords;
+2 -4
View File
@@ -256,10 +256,8 @@ impl<'a, P: Clone + Hash + Send + Sync + 'static> DockGroup<'a, P> {
/// The group named by `anchor` (one of its panels) with its `panels`, `active` showing. The group is named by the
/// active panel's title.
pub fn new(anchor: P, panels: &'a [PanelTitle], active: PanelKey) -> Self {
let props = ContainerProps::new()
.sizing(Sizing::Fill)
.header(HeaderRegion::new().fill(SurfaceKind::Background))
.command_scope(DockCommands::SCOPE);
let props =
ContainerProps::new().sizing(Sizing::Fill).header(HeaderRegion::new().fill(SurfaceKind::Background)).command_scope(DockCommands::SCOPE);
let title = panels.iter().find(|panel| panel.key == active).map(|panel| panel.title.clone()).unwrap_or_default();
DockGroup {
common: Common::new(),
+1 -2
View File
@@ -634,8 +634,7 @@ impl FooterBar {
DialogRole::Destructive => Variant::DANGER,
DialogRole::Cancel | DialogRole::Other => Variant::SECONDARY,
};
let mut widget =
Button::new(button.label.clone()).variant(variant).enabled(button.enabled).least_width(least);
let mut widget = Button::new(button.label.clone()).variant(variant).enabled(button.enabled).least_width(least);
if column {
widget = widget.sizing(Sizing::FillWidth);
}
+1 -3
View File
@@ -12,9 +12,7 @@ mod words;
// Panel.
mod panel;
pub use footer::{
DialogRole, DropAction, DropActionOutput, DropActionStyle, FooterAction, FooterBar, FooterButton, FooterDrop, FooterOutput,
};
pub use footer::{DialogRole, DropAction, DropActionOutput, DropActionStyle, FooterAction, FooterBar, FooterButton, FooterDrop, FooterOutput};
pub use group_box::{GroupBox, GroupBoxStyle};
pub use section::{Section, SectionOutput, SectionStyle};
pub use stack::{SectionStack, SectionStackOutput, SectionStackStyle, StackRows, StackSlot};
+3 -1
View File
@@ -3,7 +3,9 @@
use super::hide::{self, Shown};
use crate::contract::overlay::PlacementChange;
use crate::contract::{Bind, BindMut, BodyCx, Cx, Entry, NoValue, Outcome, Pad, Pointer as _, Props as _, ShowContainer as _, Sizing, WordSetCx as _};
use crate::contract::{
Bind, BindMut, BodyCx, Cx, Entry, NoValue, Outcome, Pad, Pointer as _, Props as _, ShowContainer as _, Sizing, WordSetCx as _,
};
use crate::docking::SplitFramesCx as _;
use crate::docking::stack::{StackSection, StackSections, section_heights};
use crate::docking::tree::FrameRules;
@@ -332,10 +332,7 @@ 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, units.name(UnitKind::Pixels)),
Entry::new(UnitKind::Percent, units.name(UnitKind::Percent)),
];
let kinds = [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| {
let range = link.width_range();
@@ -333,8 +333,7 @@ impl Kit {
pub(super) fn new(ui: &Ui) -> Self {
let env = Env::of(ui);
let units = env.units();
let entries =
|kinds: &[UnitKind]| -> Vec<Entry<UnitKind>> { kinds.iter().map(|kind| Entry::new(*kind, units.name(*kind))).collect() };
let entries = |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]));
@@ -4,13 +4,13 @@ use super::{CanvasExtension, Kit, LinkedSize, SizeForm, SizingOutput, set_size_j
use crate::choice::Checkbox;
use crate::contract::{Bind, Props as _, Show as _, ShowContainer as _};
use crate::dialog::{DialogId, DialogResult, DialogStack, FieldRefusal, StackDialog, dialog_id};
use crate::display::Text;
use crate::form::Field;
use crate::pickers::{Anchor9, ReferencePoint, Select};
use crate::display::Text;
use crate::runtime::env::{ColumnSize, Label, UnitKind};
use crate::sections::Section;
use craft_theme::variant::Tone;
use craft_behavior::PixelSize;
use craft_theme::variant::Tone;
use egui::Ui;
use serde_json::json;
@@ -195,8 +195,7 @@ impl<'a> CanvasSize<'a> {
sized_section(ui, "new", &words.new_size, kit.file_size(now, bytes_per_pixel), kit.tone_of(now), |ui| {
kit.refusal(ui, now);
kit.sides(ui, &mut state.size);
let check =
Checkbox::new(Bind::given(state.size.is_relative())).label(words.relative.clone()).id_salt("relative").show(ui);
let check = Checkbox::new(Bind::given(state.size.is_relative())).label(words.relative.clone()).id_salt("relative").show(ui);
if let Some(on) = check.value().copied() {
state.size.relative(on);
}
@@ -45,7 +45,9 @@ fn preset_picker_chip(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
let (swatch, state) = data.value("chip", (Some(TEAL), PresetState::<u32>::new()));
let mut output = None;
Bar::new("Brush options", BarKind::Options).show(ui, |ui, _| {
output = Some(PresetPicker::new("Swatch", Bind::bound(&mut *swatch), &rows, Bind::bound(&mut *state)).field(PickerField::Chip).caption("20").show(ui));
output = Some(
PresetPicker::new("Swatch", Bind::bound(&mut *swatch), &rows, Bind::bound(&mut *state)).field(PickerField::Chip).caption("20").show(ui),
);
});
output.map(StoryOutput::from).unwrap_or_default()
}
+2 -2
View File
@@ -14,8 +14,8 @@ use super::screen_mode::{ScreenMode, ScreenModeCommands, ScreenModeFollow};
use super::words::ShellWords;
use crate::contract::overlay::Resize;
use crate::contract::{
Bind, BodyCx, BodyLayout, Common, Component, Container, ContainerProps, Cx, Mount, NoValue, Outcome, PaneEdge, Props as _, Remember as _, Role, ShellPane,
ShowContainer as _, Sizing,
Bind, BodyCx, BodyLayout, Common, Component, Container, ContainerProps, Cx, Mount, NoValue, Outcome, PaneEdge, Props as _, Remember as _, Role,
ShellPane, ShowContainer as _, Sizing,
};
use crate::notices::ToastStack;
use crate::runtime::commands::{CommandAccess as _, CommandSet as _};
+20 -23
View File
@@ -259,29 +259,26 @@ impl Cells<'_> {
low.min(high)..=low.max(high)
});
let mut edited = None;
Field::new(cell.caption.clone()).id_salt(cell.key).enabled(cell.enabled).side(SideLabel::new().scrub(true)).show(
ui,
|ui, _| {
let mut field = NumberField::new(cell.caption.clone(), Bind::given(Some(shown))).range(range.clone()).scrub_by_label();
if let Some(c) = conversion {
field = if units.is_some() {
// Fixed Size with the host's units: typed text may carry any unit, read through the document.
// Its right-click is the unit menu, so the field opens no edit menu of its own.
let reader = Env::of(ui).units().document_reader(c.unit, c.extent, c.pixels_per_inch, c.points_per_inch);
field.codec(NumberCodec::new(reader, *c.unit.decimals().end())).own_context_menu()
} else {
field.unit_kind(c.unit)
};
}
let out = field.show(ui);
edited = out.value().copied().flatten();
if let Some(s) = units {
let entries: Vec<Entry<UnitKind>> = s.units.iter().map(|entry| entry.clone().checked(entry.value() == Some(&s.unit))).collect();
let menu = Menu::context(cell.caption.clone(), &out.response).values().pick(ui, &entries);
*unit_picked = unit_picked.or(menu.picked);
}
},
);
Field::new(cell.caption.clone()).id_salt(cell.key).enabled(cell.enabled).side(SideLabel::new().scrub(true)).show(ui, |ui, _| {
let mut field = NumberField::new(cell.caption.clone(), Bind::given(Some(shown))).range(range.clone()).scrub_by_label();
if let Some(c) = conversion {
field = if units.is_some() {
// Fixed Size with the host's units: typed text may carry any unit, read through the document.
// Its right-click is the unit menu, so the field opens no edit menu of its own.
let reader = Env::of(ui).units().document_reader(c.unit, c.extent, c.pixels_per_inch, c.points_per_inch);
field.codec(NumberCodec::new(reader, *c.unit.decimals().end())).own_context_menu()
} else {
field.unit_kind(c.unit)
};
}
let out = field.show(ui);
edited = out.value().copied().flatten();
if let Some(s) = units {
let entries: Vec<Entry<UnitKind>> = s.units.iter().map(|entry| entry.clone().checked(entry.value() == Some(&s.unit))).collect();
let menu = Menu::context(cell.caption.clone(), &out.response).values().pick(ui, &entries);
*unit_picked = unit_picked.or(menu.picked);
}
});
let edited = edited?;
let Some(c) = conversion else { return Some(edited) };
// A field that shows a rounded value commits the rounded value when it is left: that is no change.
+1 -2
View File
@@ -56,8 +56,7 @@ fn bar_options(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
BarHome::new("Home", Bind::bound(&mut home)).show(ui);
BarTool::new(IconId::new("brush"), "Brush").show(ui);
Field::new("Size").show(ui, |ui, _| NumberField::new("Size", Bind::bound(&mut size)).range(1.0..=5000.0).show(ui));
Field::new("Opacity")
.show(ui, |ui, _| NumberField::new("Opacity", Bind::bound(&mut opacity)).range(1.0..=100.0).show(ui));
Field::new("Opacity").show(ui, |ui, _| NumberField::new("Opacity", Bind::bound(&mut opacity)).range(1.0..=100.0).show(ui));
Field::new("Mode").show(ui, |ui, _| Select::new("Mode", Bind::bound(&mut mode), &modes).show(ui));
Divider::vertical().show(ui);
Checkbox::new(Bind::bound(&mut sample_all)).label("Sample All Layers").show(ui);
+3 -1
View File
@@ -59,7 +59,9 @@ impl ListRow<'_> {
icon.color.get_or_insert(cx.resolve(&cx.style.trailing_icon.color));
ui.draw().icon(shape, &icon);
}
TrailingFace::Icon(icon) => ui.face(key, IconButton::new(icon.clone()).focusable(false).enabled(*enabled).glyphs(GlyphRole::PanelRail)),
TrailingFace::Icon(icon) => {
ui.face(key, IconButton::new(icon.clone()).focusable(false).enabled(*enabled).glyphs(GlyphRole::PanelRail))
}
TrailingFace::Disclosure { open } => ui.face(key, Disclosure::new(Bind::given(*open)).node(false).enabled(*enabled)),
TrailingFace::Strong(text) => {
ui.draw().text(*slot, &trailing_run(text, true));