Merge pull request 'fix(engine): clicking the waste card no longer draws from stock' (#104) from fix/waste-click-draws into master
This commit was merged in pull request #104.
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
//! - `Esc` → handled by `PausePlugin` (overlay toggle + paused flag)
|
||||
//!
|
||||
//! 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
|
||||
//! the origin pile and whatever pile the cursor is over at release.
|
||||
//! 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
|
||||
// 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
|
||||
// Klondike UX clicking either card draws from the deck.
|
||||
// at Tableau1's x (col_x(0)). Only the deck draws — clicking the waste card must
|
||||
// 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 {
|
||||
return;
|
||||
};
|
||||
@@ -549,9 +551,7 @@ fn handle_stock_click(
|
||||
return;
|
||||
};
|
||||
let deck_pos = Vec2::new(t1_pos.x, waste_pos.y);
|
||||
if point_in_rect(world, deck_pos, layout.0.card_size)
|
||||
|| point_in_rect(world, waste_pos, layout.0.card_size)
|
||||
{
|
||||
if point_in_rect(world, deck_pos, layout.0.card_size) {
|
||||
draw.write(DrawRequestEvent);
|
||||
}
|
||||
}
|
||||
@@ -596,9 +596,9 @@ fn handle_touch_stock_tap(
|
||||
continue;
|
||||
};
|
||||
let deck_pos = Vec2::new(t1_pos.x, waste_pos.y);
|
||||
if point_in_rect(world, deck_pos, layout.0.card_size)
|
||||
|| point_in_rect(world, waste_pos, layout.0.card_size)
|
||||
{
|
||||
// Only the face-down deck draws; tapping the waste card leaves it free to
|
||||
// play (double-tap to auto-move, or drag).
|
||||
if point_in_rect(world, deck_pos, layout.0.card_size) {
|
||||
draw.write(DrawRequestEvent);
|
||||
game_consumed.0 = true;
|
||||
break; // one draw per tap frame
|
||||
|
||||
Reference in New Issue
Block a user