summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-06 08:28:35 -0500
committerLinus Groh <mail@linusgroh.de>2023-01-06 15:55:37 +0100
commit08ff87b3ce6313506a8e27ec3b5bb672fd503859 (patch)
treed574a53010383d7de4560e668842daf0306ed45b /Userland
parent2a1fb77faf2bab7b742b4e66f05cfd34eaff279b (diff)
downloadserenity-08ff87b3ce6313506a8e27ec3b5bb672fd503859.zip
Solitaire: Preview cards in a stack with the right mouse button
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Games/Solitaire/Game.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/Userland/Games/Solitaire/Game.cpp b/Userland/Games/Solitaire/Game.cpp
index 302d3d86fe..3eb831ddf0 100644
--- a/Userland/Games/Solitaire/Game.cpp
+++ b/Userland/Games/Solitaire/Game.cpp
@@ -257,10 +257,14 @@ void Game::mousedown_event(GUI::MouseEvent& event)
if (is_auto_collecting() && attempt_to_move_card_to_foundations(to_check))
break;
- pick_up_cards_from_stack(to_check, click_location, Cards::CardStack::MovementRule::Alternating);
+ if (event.button() == GUI::MouseButton::Secondary) {
+ preview_card(to_check, click_location);
+ } else {
+ pick_up_cards_from_stack(to_check, click_location, Cards::CardStack::MovementRule::Alternating);
+ m_mouse_down_location = click_location;
+ m_mouse_down = true;
+ }
- m_mouse_down_location = click_location;
- m_mouse_down = true;
start_timer_if_necessary();
}
}
@@ -274,6 +278,11 @@ void Game::mouseup_event(GUI::MouseEvent& event)
GUI::Frame::mouseup_event(event);
clear_hovered_stack();
+ if (is_previewing_card()) {
+ clear_card_preview();
+ return;
+ }
+
if (!is_moving_cards() || m_game_over_animation || m_new_game_animation)
return;