diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-12-22 14:50:27 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-12-22 14:50:27 +0000 |
commit | 8d0f3af2cbbfab9dfb2b613b4ea3413e2ce04d4d (patch) | |
tree | b584e6c88224851f1ee1f60169ea4ee0b7dd2588 /ui/uiComponent.cpp | |
parent | RAII for glVertex and glBuffer (diff) | |
download | ilt-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/uiComponent.cpp')
-rw-r--r-- | ui/uiComponent.cpp | 7 |
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; } |