summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-12-22 14:50:27 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-12-22 14:50:27 +0000
commit8d0f3af2cbbfab9dfb2b613b4ea3413e2ce04d4d (patch)
treeb584e6c88224851f1ee1f60169ea4ee0b7dd2588 /ui
parentRAII for glVertex and glBuffer (diff)
downloadilt-8d0f3af2cbbfab9dfb2b613b4ea3413e2ce04d4d.tar.bz2
ilt-8d0f3af2cbbfab9dfb2b613b4ea3413e2ce04d4d.tar.xz
ilt-8d0f3af2cbbfab9dfb2b613b4ea3413e2ce04d4d.zip
Component position mouse click check should only match mouse button events
Diffstat (limited to 'ui')
-rw-r--r--ui/uiComponent.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/uiComponent.cpp b/ui/uiComponent.cpp
index ef62db9..e480fbc 100644
--- a/ui/uiComponent.cpp
+++ b/ui/uiComponent.cpp
@@ -23,5 +23,10 @@ UIComponent::Position::operator&(const glm::vec2 & pos) const
bool
UIComponent::Position::operator&(const SDL_MouseButtonEvent & pos) const
{
- return *this & glm::vec2 {pos.x, pos.y};
+ switch (pos.type) {
+ case SDL_MOUSEBUTTONUP:
+ case SDL_MOUSEBUTTONDOWN:
+ return *this & glm::vec2 {pos.x, pos.y};
+ }
+ return false;
}