cargo fmt

This commit is contained in:
aiongg
2026-11-12 14:32:44 +00:00
parent c2cf58941d
commit 26a80efde5
3 changed files with 20 additions and 12 deletions
+8 -10
View File
@@ -330,8 +330,7 @@ impl<'a> HarmonyPanel<'a> {
let strip: Vec<(Label, Srgba)> = guide.colors.iter().map(|c| (Label::from(c.to_hex()), *c)).collect();
let mut strip_selection = Selection::default();
let out =
SwatchTable::new(words.harmony.clone(), &strip)
let out = SwatchTable::new(words.harmony.clone(), &strip)
.per_row(strip.len().max(1))
.span(true)
.selection(Bind::bound(&mut strip_selection))
@@ -344,14 +343,13 @@ impl<'a> HarmonyPanel<'a> {
let centre = guide.centre();
let flat: Vec<(Label, Srgba)> = guide.grid.iter().flatten().map(|c| (Label::from(c.to_hex()), *c)).collect();
let mut selection = if before_picked.guide == stamp { before_picked.selection.clone() } else { Selection::default() };
let SwatchTableOutput { selected, chosen: cells, .. } =
SwatchTable::new(words.variations.clone(), &flat)
.multiple(true)
.per_row(columns)
.span(true)
.marked(move |&at| at % columns == centre)
.selection(Bind::bound(&mut selection))
.show_all(ui);
let SwatchTableOutput { selected, chosen: cells, .. } = SwatchTable::new(words.variations.clone(), &flat)
.multiple(true)
.per_row(columns)
.span(true)
.marked(move |&at| at % columns == centre)
.selection(Bind::bound(&mut selection))
.show_all(ui);
if let Some(i) = selected
&& cells.len() == 1
{
+1 -1
View File
@@ -4,12 +4,12 @@
use craft_behavior::{DisplayOrder, EditEvent, ItemSource, Metrics, Mixed, Selection, TileLayout};
use craft_theme::Srgba;
use craft_ui::choice::{Swatch, SwatchMetrics};
use craft_ui::list::RowTest;
use craft_ui::contract::{
ActivateOn, Bind, BindMut, Collection, CollectionEvent, CollectionProps, Common, Component, ContainerProps, Cx, Held, NoValue, Outcome, Pattern,
Props, Role, SelectMode, ShowCollection as _, ShowContainer as _, Sizing,
};
use craft_ui::layout_components::Stack;
use craft_ui::list::RowTest;
use craft_ui::runtime::env::Label;
use craft_ui::style::{ComponentStyle, StyleCx};
use egui::{Response, Ui, Vec2};
+11 -1
View File
@@ -80,7 +80,17 @@ pub struct Span<'a> {
impl<'a> Span<'a> {
/// A plain span.
pub fn new(text: impl Into<Cow<'a, str>>) -> Self {
Span { text: text.into(), italic: false, tabular: false, mono: false, muted: false, shortcut: false, highlight: false, underline: false, strong: false }
Span {
text: text.into(),
italic: false,
tabular: false,
mono: false,
muted: false,
shortcut: false,
highlight: false,
underline: false,
strong: false,
}
}
/// Italic.