summaryrefslogtreecommitdiff
path: root/Userland/Games/Chess
diff options
context:
space:
mode:
authorBrendan Coles <bcoles@gmail.com>2021-02-18 08:16:17 +0000
committerAndreas Kling <kling@serenityos.org>2021-02-18 12:52:11 +0100
commit44aeab43a0e273bf275a65588b909120e43937d8 (patch)
treedcbc3ab15d8fd9d01e6a89803224e52a0ca0573d /Userland/Games/Chess
parentc2c7c7368b749cca5f182b01231c56aac24a5062 (diff)
downloadserenity-44aeab43a0e273bf275a65588b909120e43937d8.zip
Chess: Allow right click to cancel drag move while dragging a piece
Diffstat (limited to 'Userland/Games/Chess')
-rw-r--r--Userland/Games/Chess/ChessWidget.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Games/Chess/ChessWidget.cpp b/Userland/Games/Chess/ChessWidget.cpp
index 6d74a5da20..c3c083f8d0 100644
--- a/Userland/Games/Chess/ChessWidget.cpp
+++ b/Userland/Games/Chess/ChessWidget.cpp
@@ -168,7 +168,11 @@ void ChessWidget::mousedown_event(GUI::MouseEvent& event)
GUI::Widget::mousedown_event(event);
if (event.button() == GUI::MouseButton::Right) {
- m_current_marking.from = mouse_to_square(event);
+ if (m_dragging_piece) {
+ m_dragging_piece = false;
+ } else {
+ m_current_marking.from = mouse_to_square(event);
+ }
return;
}
m_board_markings.clear();