From f88b6f61d065d720ce8eef84a667d362becb23fb Mon Sep 17 00:00:00 2001 From: funman300 Date: Wed, 24 Jun 2026 10:31:21 -0700 Subject: [PATCH] fix(engine): clicking the waste card no longer draws from stock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit handle_stock_click (and handle_touch_stock_tap) hit-tested both the face-down deck AND the waste slot, so a click/tap on the drawn waste card fired DrawRequestEvent — drawing the next card instead of playing the waste card, and swallowing the first click of a double-click so auto-move never triggered. Only the deck draws now. The waste card is left free to play: double-click / double-tap to auto-move, or drag it. Co-Authored-By: Claude Opus 4.8 (1M context) --- solitaire_engine/src/input_plugin.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/solitaire_engine/src/input_plugin.rs b/solitaire_engine/src/input_plugin.rs index f1ee247..b8c07ff 100644 --- a/solitaire_engine/src/input_plugin.rs +++ b/solitaire_engine/src/input_plugin.rs @@ -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