mirror of
https://github.com/storytold/lightcraft.git
synced 2026-12-06 17:01:16 -05:00
hold debug 5
This commit is contained in:
@@ -102,6 +102,24 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
|
||||
super::scroll_focus::reveal_focus(ui, egui::Id::unique("right-scroll-focus"));
|
||||
});
|
||||
ui.data_mut(|d| d.insert_temp(egui::Id::unique(AREA), scrolled.id));
|
||||
{
|
||||
let now = (scrolled.state.offset().y, scrolled.content_size.y);
|
||||
let last = ui.data(|d| d.get_temp::<(f32, f32)>(egui::Id::unique("dbg-last")));
|
||||
ui.data_mut(|d| d.insert_temp(egui::Id::unique("dbg-last"), now));
|
||||
if last != Some(now) {
|
||||
eprintln!(
|
||||
"DBGSHOW pass={} sizing={} measure={} held={held:?} start={start:?} ended={ended:?} offset {:?} -> {} content {:?} -> {} inner={}",
|
||||
ui.ctx().cumulative_pass_nr(),
|
||||
ui.is_sizing_pass(),
|
||||
craft::ui::runtime::measure::active(ui.ctx()),
|
||||
last.map(|l| l.0),
|
||||
now.0,
|
||||
last.map(|l| l.1),
|
||||
now.1,
|
||||
scrolled.inner_rect.height()
|
||||
);
|
||||
}
|
||||
}
|
||||
// (the offset this real pass ended at: the next pass holds from it, not from the state a sizing or
|
||||
// measuring run in between may already have pulled back as the content shrank)
|
||||
if !(ui.is_sizing_pass() || craft::ui::runtime::measure::active(ui.ctx())) {
|
||||
|
||||
@@ -336,6 +336,9 @@ fn hold_list_in_place(ui: &mut egui::Ui, top: f32) {
|
||||
ui.data_mut(|d| d.insert_temp(key, (height, pass)));
|
||||
let Some(before) = before else { return };
|
||||
let grew = height - before;
|
||||
if grew.abs() >= 0.5 {
|
||||
eprintln!("DBGCHANGE pass={pass} grew={grew} top={top} clip_top={} ptr={:?}", ui.clip_rect().top(), ui.input(|i| i.pointer.latest_pos()));
|
||||
}
|
||||
if !grew.is_finite() || grew.abs() < 0.5 || top >= ui.clip_rect().top() - 0.5 {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -645,7 +645,9 @@ fn ticking_a_keyword_keeps_the_list_in_place() {
|
||||
let picked: Vec<String> = (30..36).map(|i| format!("zz{i}")).collect();
|
||||
for (n, k) in picked.iter().chain(picked.iter().rev()).enumerate() {
|
||||
let (before, box_top) = (rect(&h, &format!("keywordRow:{k}")), rect(&h, "field:keyword").top());
|
||||
eprintln!("DBGTICK click {k} before={before:?}");
|
||||
ask(&mut h, "ui.clickWidget", json!({"id": format!("keywordCheck:{k}")}));
|
||||
eprintln!("DBGTICK done {k} after={:?}", rect(&h, &format!("keywordRow:{k}")));
|
||||
assert_eq!(rect(&h, &format!("keywordRow:{k}")), before, "{k} stayed under the pointer");
|
||||
// (the click found the row where it is drawn, not where a discarded pass had it)
|
||||
assert_eq!(keywords_of(&h, ids[0]).contains(k), n < picked.len(), "{k} was the one ticked: {:?}", keywords_of(&h, ids[0]));
|
||||
|
||||
Reference in New Issue
Block a user