mirror of
https://github.com/storytold/craft-libs.git
synced 2026-12-01 10:48:15 +01:00
BarItems: a checked command's item shows on
A bar item whose command is checked got the toggle face, but its part carried no checked state, so the face painted off and the node did not read on (DeckCraft's Home in the Quick Access Toolbar while Home is open). The item's part now takes the checked flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b802c4dbd4
commit
bbfbcda742
1 file changed
+6
-2
@@ -14,7 +14,7 @@ use crate::runtime::env::Label;
|
||||
use crate::style::{ComponentStyle, FocusLook, GlyphRole, StyleCx};
|
||||
use craft_behavior::fit::{FitItem, FitKeep, fit_items};
|
||||
use craft_behavior::{Axis, IconId, Metrics, NavShape, PartKey, PartRef, Proposal, Roving, Sense};
|
||||
use craft_theme::Variant;
|
||||
use craft_theme::{Flags, Variant};
|
||||
use egui::{Rect, Response, Vec2, pos2};
|
||||
|
||||
const ITEM: PartKey = PartKey::new("item");
|
||||
@@ -439,7 +439,11 @@ impl Component for BarItems {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let part = cx.part(ITEM.at(index as u64), cell).sense(sense).focusable();
|
||||
let mut part = cx.part(ITEM.at(index as u64), cell).sense(sense).focusable();
|
||||
// A toggle item's face paints on, and its node reads on, from the part's state.
|
||||
if present[index].resolved.checked == Some(true) {
|
||||
part = part.flags(Flags::CHECKED);
|
||||
}
|
||||
if let Some(tooltip) = tooltip {
|
||||
part.tooltip(tooltip);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user