mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 05:37:04 +00:00
rr-ribbon-w1: red round 2 (lead commit)
This commit is contained in:
@@ -226,7 +226,15 @@ impl<'a> StyleCx<'a> {
|
||||
pub fn exiting<P: Clone + Send + Sync + 'static>(&self, name: &'static str, spec: MotionSpec, listed: &[impl Hash]) -> Vec<(Presence, P)> {
|
||||
let Some((id, policy)) = self.owner else { return Vec::new() };
|
||||
let listed: Vec<Id> = listed.iter().map(crate::runtime::motion::key_id).collect();
|
||||
crate::runtime::motion::peek_exiting(self.ctx, id, policy, name, spec, &listed)
|
||||
let out = crate::runtime::motion::peek_exiting(self.ctx, id, policy, name, spec, &listed);
|
||||
eprintln!(
|
||||
"DIAG a_contextual_tab_that_leaves_is_not_hit_or_listed_while_it_fades: style exiting owner={id:?} pass={} measuring={} listed={} out={:?}",
|
||||
self.ctx.current_pass_index(),
|
||||
crate::runtime::measure::active(self.ctx),
|
||||
listed.len(),
|
||||
out.iter().map(|(presence, _)| presence.t).collect::<Vec<f32>>()
|
||||
);
|
||||
out
|
||||
}
|
||||
|
||||
/// The same context with another variant.
|
||||
|
||||
@@ -643,6 +643,15 @@ impl<'a, K: Clone + Eq + Hash + Send + Sync + std::fmt::Debug + 'static> TabStri
|
||||
drop(texts);
|
||||
// The same keys in the same order as the layout reserved their slots from (`reserved`).
|
||||
self.ghosts = cx.exiting::<Ghost>(LEAVE, spec::OPEN_FADE).into_iter().map(|(presence, ghost)| Fading { label: ghost.label, alpha: presence.t }).collect();
|
||||
eprintln!(
|
||||
"DIAG a_contextual_tab_that_leaves_is_not_hit_or_listed_while_it_fades: track id={:?} pass={} texts={} placed={:?} report_ghosts={:?} ghosts={:?}",
|
||||
cx.core.id,
|
||||
cx.core.ctx.current_pass_index(),
|
||||
self.texts.borrow().len(),
|
||||
report.placed,
|
||||
report.ghosts,
|
||||
self.ghosts
|
||||
);
|
||||
}
|
||||
|
||||
/// The menus of the end items that open one, each below its item.
|
||||
@@ -687,13 +696,24 @@ impl<'a, K: Clone + Eq + Hash + Send + Sync + std::fmt::Debug + 'static> TabStri
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(slot, (_, ghost))| Some(Reserved { slot, before: ghost.before.min(listed.len()), width: ghost.width? }))
|
||||
.collect();
|
||||
.collect::<Vec<Reserved>>();
|
||||
eprintln!(
|
||||
"DIAG a_contextual_tab_that_leaves_is_not_hit_or_listed_while_it_fades: reserved listed={} departing={:?} reserved={reserved:?}",
|
||||
listed.len(),
|
||||
departing.iter().map(|(presence, ghost)| (presence.t, ghost.before, ghost.width)).collect::<Vec<_>>()
|
||||
);
|
||||
(reserved, departing.len())
|
||||
}
|
||||
|
||||
/// The departed contextual tabs at the slots the fit kept for them, each painted as the `Tab` it was, as opaque
|
||||
/// as its presence has left it.
|
||||
fn paint_ghosts(&self, ui: &mut PaintUi<'_>, report: &Report) {
|
||||
if self.roles.is_some() {
|
||||
eprintln!(
|
||||
"DIAG a_contextual_tab_that_leaves_is_not_hit_or_listed_while_it_fades: paint ghosts={:?} report_ghosts={:?}",
|
||||
self.ghosts, report.ghosts
|
||||
);
|
||||
}
|
||||
for (at, fading) in self.ghosts.iter().enumerate() {
|
||||
if report.ghosts.get(at).copied().flatten().is_some() {
|
||||
let tab = Tab::new(fading.label.clone()).kind(TabKind::Ribbon).role(TabRole::Contextual);
|
||||
|
||||
Reference in New Issue
Block a user