debug(input): log drag failures to browser console for diagnosis
Add warn!/info! calls to start_drag so every click that doesn't produce a drag emits a console line with the cursor world position, stock/waste sizes, and per-tableau pile lengths. This lets us see in browser DevTools whether find_draggable_at is returning None (wrong hit position) or something earlier in the pipeline is blocking. Remove once root cause is identified. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -621,15 +621,35 @@ fn start_drag(
|
||||
{
|
||||
return;
|
||||
}
|
||||
let Some(layout) = layout else { return };
|
||||
let Some(layout) = layout else {
|
||||
bevy::log::warn!("[drag] no layout — skipping");
|
||||
return;
|
||||
};
|
||||
let Some(world) = cursor_world(&windows, &cameras) else {
|
||||
bevy::log::warn!("[drag] cursor_world returned None (no camera?)");
|
||||
return;
|
||||
};
|
||||
|
||||
// Don't pick up the stock — that is handled by handle_stock_click.
|
||||
let Some((pile, stack_index, card_ids)) = find_draggable_at(world, &game.0, &layout.0) else {
|
||||
bevy::log::info!(
|
||||
"[drag] no draggable at world {:?} — stock={:?} waste_len={} tab_lens={:?}",
|
||||
world,
|
||||
layout.0.pile_positions.get(&KlondikePile::Stock),
|
||||
game.0.waste_cards().len(),
|
||||
[
|
||||
game.0.pile(KlondikePile::Tableau(Tableau::Tableau1)).len(),
|
||||
game.0.pile(KlondikePile::Tableau(Tableau::Tableau2)).len(),
|
||||
game.0.pile(KlondikePile::Tableau(Tableau::Tableau3)).len(),
|
||||
game.0.pile(KlondikePile::Tableau(Tableau::Tableau4)).len(),
|
||||
game.0.pile(KlondikePile::Tableau(Tableau::Tableau5)).len(),
|
||||
game.0.pile(KlondikePile::Tableau(Tableau::Tableau6)).len(),
|
||||
game.0.pile(KlondikePile::Tableau(Tableau::Tableau7)).len(),
|
||||
]
|
||||
);
|
||||
return;
|
||||
};
|
||||
bevy::log::info!("[drag] started: pile={:?} stack_index={} cards={:?}", pile, stack_index, card_ids);
|
||||
|
||||
let bottom_pos = card_position(&game.0, &layout.0, &pile, stack_index);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user