From 8d0f3af2cbbfab9dfb2b613b4ea3413e2ce04d4d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 22 Dec 2021 14:50:27 +0000 Subject: Component position mouse click check should only match mouse button events --- ui/uiComponent.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ui') 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; } -- cgit v1.2.3