mirror of
https://github.com/storytold/craft-libs.git
synced 2026-12-01 02:36:54 +01:00
menu gallery: the current tile is outlined in the accent, with no fill
The current tile of a gallery was a state.selected fill inside a line.control_edge edge, which on the Styles gallery read as a grey tile. It is now a thin outline in accent.border, the colour a selected icon button's outline takes, and the tile keeps its own background. The outline is still a shape, so the current tile is not marked by colour alone. Reference: storytold/wordcraft#7678. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d445d2cf26
commit
7f8fec0e54
1 file changed
+3
-11
@@ -366,11 +366,7 @@ struct GalleryTileStyle {
|
||||
focus: FocusLook,
|
||||
/// Between the tile's edge and its picture.
|
||||
pad: f32,
|
||||
/// The selection edge's width.
|
||||
stroke: f32,
|
||||
/// The current tile's fill.
|
||||
fill: StyleColor,
|
||||
/// The current tile's edge.
|
||||
/// The current tile's outline: accent, unfilled, so the picture keeps its own background.
|
||||
edge: StyleColor,
|
||||
/// The ink of the item's name under the picture, in a captioned gallery.
|
||||
caption: StyleColor,
|
||||
@@ -443,9 +439,7 @@ impl Component for GalleryTile<'_> {
|
||||
metrics: Metrics::new().padding(Insets::new(pad, pad, pad, pad)),
|
||||
focus: cx.focus_look(),
|
||||
pad,
|
||||
stroke: cx.tokens.stroke.thin,
|
||||
fill: cx.color(colors.state.selected),
|
||||
edge: cx.color(colors.line.control_edge),
|
||||
edge: cx.color(colors.accent.border),
|
||||
caption: cx.color(colors.text.normal),
|
||||
gap: cx.tokens.space.gap.tight,
|
||||
thumbs: [cx.tokens.size.thumb.sm, cx.tokens.size.thumb.md, cx.tokens.size.thumb.lg],
|
||||
@@ -472,9 +466,7 @@ impl Component for GalleryTile<'_> {
|
||||
}
|
||||
if self.selected {
|
||||
let outer = area.expand(cx.style.pad);
|
||||
let draw = ui.draw();
|
||||
draw.fill(&PaintShape::Rect(outer, CornerRadius::ZERO), cx.style.edge);
|
||||
draw.fill(&PaintShape::Rect(outer.shrink(cx.style.stroke), CornerRadius::ZERO), cx.style.fill);
|
||||
ui.draw().stroke(&PaintShape::Rect(outer, CornerRadius::ZERO), craft_ui::primitives::StrokeWidth::Thin, cx.style.edge);
|
||||
}
|
||||
// A captioned tile keeps the picture's height at the top and shows the name in the rest under it.
|
||||
let (area, caption) = match self.caption {
|
||||
|
||||
Reference in new issue
Block a user