fix(engine): clicking the waste card no longer draws from stock #104
@@ -10,7 +10,8 @@
|
|||||||
//! - `Esc` → handled by `PausePlugin` (overlay toggle + paused flag)
|
//! - `Esc` → handled by `PausePlugin` (overlay toggle + paused flag)
|
||||||
//!
|
//!
|
||||||
//! Mouse:
|
//! Mouse:
|
||||||
//! - Left-click on the stock pile (face-down deck) or waste slot → `DrawRequestEvent`
|
//! - Left-click on the stock pile (face-down deck) → `DrawRequestEvent`
|
||||||
|
//! (the waste card is left free to play: double-click to auto-move, or drag)
|
||||||
//! - Left-press-drag-release on a face-up card → `MoveRequestEvent` between
|
//! - Left-press-drag-release on a face-up card → `MoveRequestEvent` between
|
||||||
//! the origin pile and whatever pile the cursor is over at release.
|
//! the origin pile and whatever pile the cursor is over at release.
|
||||||
//! On rejection, the drag cards snap back to their origin via a
|
//! On rejection, the drag cards snap back to their origin via a
|
||||||
@@ -536,8 +537,9 @@ fn handle_stock_click(
|
|||||||
|
|
||||||
// `pile_positions[Stock]` is the waste column (col_x(1)). card_plugin renders the
|
// `pile_positions[Stock]` is the waste column (col_x(1)). card_plugin renders the
|
||||||
// face-down deck one column to the left via `base.x -= tableau_col_step`, placing it
|
// face-down deck one column to the left via `base.x -= tableau_col_step`, placing it
|
||||||
// at Tableau1's x (col_x(0)). Hit-test both the deck AND the waste slot: in standard
|
// at Tableau1's x (col_x(0)). Only the deck draws — clicking the waste card must
|
||||||
// Klondike UX clicking either card draws from the deck.
|
// leave it free to be played (double-click to auto-move, or drag); hit-testing the
|
||||||
|
// waste slot here would intercept that click and draw the next card instead.
|
||||||
let Some(&waste_pos) = layout.0.pile_positions.get(&KlondikePile::Stock) else {
|
let Some(&waste_pos) = layout.0.pile_positions.get(&KlondikePile::Stock) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -549,9 +551,7 @@ fn handle_stock_click(
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let deck_pos = Vec2::new(t1_pos.x, waste_pos.y);
|
let deck_pos = Vec2::new(t1_pos.x, waste_pos.y);
|
||||||
if point_in_rect(world, deck_pos, layout.0.card_size)
|
if point_in_rect(world, deck_pos, layout.0.card_size) {
|
||||||
|| point_in_rect(world, waste_pos, layout.0.card_size)
|
|
||||||
{
|
|
||||||
draw.write(DrawRequestEvent);
|
draw.write(DrawRequestEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -596,9 +596,9 @@ fn handle_touch_stock_tap(
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let deck_pos = Vec2::new(t1_pos.x, waste_pos.y);
|
let deck_pos = Vec2::new(t1_pos.x, waste_pos.y);
|
||||||
if point_in_rect(world, deck_pos, layout.0.card_size)
|
// Only the face-down deck draws; tapping the waste card leaves it free to
|
||||||
|| point_in_rect(world, waste_pos, layout.0.card_size)
|
// play (double-tap to auto-move, or drag).
|
||||||
{
|
if point_in_rect(world, deck_pos, layout.0.card_size) {
|
||||||
draw.write(DrawRequestEvent);
|
draw.write(DrawRequestEvent);
|
||||||
game_consumed.0 = true;
|
game_consumed.0 = true;
|
||||||
break; // one draw per tap frame
|
break; // one draw per tap frame
|
||||||
|
|||||||
Reference in New Issue
Block a user