aboutsummaryrefslogtreecommitdiff
path: root/src/gui/Button.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-03 23:36:11 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-03 23:36:11 +0200
commit3a20c417cbf7d5db1d9d26abfbda388e58f96c18 (patch)
treea7552bff0a5164446eaade0dde570cd6111e474d /src/gui/Button.cpp
parentc080342fcd358561af7edc64cea2222880923b93 (diff)
Align list items, dont process selected item twice if changed in event loop, mouse button events should only occur when pressing left mouse button
Diffstat (limited to 'src/gui/Button.cpp')
-rw-r--r--src/gui/Button.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/Button.cpp b/src/gui/Button.cpp
index b530004..eb5932b 100644
--- a/src/gui/Button.cpp
+++ b/src/gui/Button.cpp
@@ -14,7 +14,7 @@ namespace gsr {
bool Button::on_event(mgl::Event &event, mgl::Window&, mgl::vec2f offset) {
if(event.type == mgl::Event::MouseMoved) {
mouse_inside = mgl::FloatRect(position + offset, size).contains({ (float)event.mouse_move.x, (float)event.mouse_move.y });
- } else if(event.type == mgl::Event::MouseButtonPressed) {
+ } else if(event.type == mgl::Event::MouseButtonPressed && event.mouse_button.button == mgl::Mouse::Left) {
const bool clicked_inside = mouse_inside;
if(clicked_inside && on_click)
on_click();