mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 20:14:31 +01:00
Merge branch 'red/rr-ribbon-w5' into area/ribbon-fw
This commit is contained in:
commit
274deffacc
3 files changed
+10
-14
No files matched your search
@@ -28,9 +28,9 @@ pub struct KeytipsStyle {
|
||||
/// The room around a badge's letters; its top is also a badge's inset from its control's corner.
|
||||
#[style(metrics)]
|
||||
metrics: Metrics,
|
||||
/// A badge: the accent fill, with the ring that parts it from the control under it.
|
||||
#[style(surface)]
|
||||
surface: SurfaceLook,
|
||||
/// A badge: the accent fill, with the ring that parts it from the control under it. Not the component's root
|
||||
/// surface, which would fill the whole area the keytips show over.
|
||||
badge: SurfaceLook,
|
||||
/// The badge letters.
|
||||
#[style(text)]
|
||||
text: TextLook,
|
||||
@@ -374,12 +374,12 @@ impl Component for Keytips<'_> {
|
||||
fn style(cx: &StyleCx<'_>, _: KeytipsStyleKey) -> KeytipsStyle {
|
||||
let colors = &cx.tokens.color;
|
||||
let pad = cx.tokens.space.pad.chip;
|
||||
let surface = SurfaceLook::new(Stateful::new(cx.color(colors.accent.solid)))
|
||||
let badge = SurfaceLook::new(Stateful::new(cx.color(colors.accent.solid)))
|
||||
.radius(UiTokens::corner(cx.tokens.shape.radius.sm))
|
||||
.border(Stateful::new(cx.color(colors.overlay.halo)), cx.tokens.stroke.thin);
|
||||
KeytipsStyle {
|
||||
metrics: Metrics::new().padding(Insets::new(pad, pad, pad, pad)),
|
||||
surface,
|
||||
badge,
|
||||
text: TextLook::new(TypeRole::Caption, Stateful::new(cx.color(colors.text.on_accent))),
|
||||
}
|
||||
}
|
||||
@@ -462,7 +462,7 @@ impl Component for Keytips<'_> {
|
||||
let run = TextRun::new(badge.clone()).role(style.text.role).color(color);
|
||||
let layout = draw.layout(&run, f32::INFINITY);
|
||||
let rect = badge_rect(*control, layout.size(), style.metrics.padding, rtl);
|
||||
draw.surface_look(rect, &style.surface, &at_rest);
|
||||
draw.surface_look(rect, &style.badge, &at_rest);
|
||||
draw.galley(rect.center() - layout.size() / 2.0, &layout);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,8 @@ pub(crate) fn begin(ctx: &Context, press_captured: bool) -> EscapeRouting {
|
||||
}
|
||||
let focused = target.as_ref().map(|rec| rec.stop.id);
|
||||
let root = target.as_ref().filter(|rec| rec.stop.root != rec.stop.id && !rec.stop.text).map(|rec| rec.stop.root);
|
||||
let menu = focus::record(ctx, crate::runtime::egui::pass::current_viewport(ctx)).menu;
|
||||
let record = focus::record(ctx, crate::runtime::egui::pass::current_viewport(ctx));
|
||||
let (menu, menu_bar) = (record.menu, record.menu_bar);
|
||||
// The web sends a chord's key press and its clipboard event: the command reaches the component once.
|
||||
let mut clips = batch.clips.clone();
|
||||
clips.dedup();
|
||||
@@ -129,10 +130,10 @@ pub(crate) fn begin(ctx: &Context, press_captured: bool) -> EscapeRouting {
|
||||
Some(intent) => push(&mut routed, driven.map(|driven| driven.list), intent, false),
|
||||
None => {
|
||||
// A capture's owner, else the claim's: the focused component's own, then its arena root's, then its
|
||||
// menu level's.
|
||||
// menu level's, then the registered menu bar's (keytips hold their letters with no focus).
|
||||
let held = |owner: Option<Id>| held_claims.iter().find(|(id, held)| Some(*id) == owner && held == chord).map(|(id, _)| *id);
|
||||
let owner = captures.iter().find(|(_, held)| held == chord).map(|(owner, _)| *owner);
|
||||
claimed.extend(owner.or_else(|| held(focused)).or_else(|| held(root)).or_else(|| held(menu)).or(focused).map(|id| (id, *chord)));
|
||||
claimed.extend(owner.or_else(|| held(focused)).or_else(|| held(root)).or_else(|| held(menu)).or_else(|| held(menu_bar)).or(focused).map(|id| (id, *chord)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,11 +43,6 @@ fn small_rooms_paint_inside_the_shown_rect(subject: &Subject) -> Result<(), Stri
|
||||
if let Some((outside, _)) =
|
||||
shapes.into_iter().find(|(bounds, overshoot)| !areas.iter().any(|area| area.expand(ROUNDING + **overshoot).contains_rect(**bounds)))
|
||||
{
|
||||
eprintln!(
|
||||
"DIAG suite::craft_menu::keytips::Keytips<'_>::reads: story {} all shapes {:?} areas {areas:?}",
|
||||
story.name,
|
||||
fixture.shape_bounds()
|
||||
);
|
||||
return Err(format!("{}: in a room of {room:?} a shape paints at {outside:?}, outside {:?}", story.name, fixture.shown()));
|
||||
}
|
||||
let tree = fixture.tree();
|
||||
|
||||
Reference in new issue
Block a user