diff options
Diffstat (limited to 'src/gui/DropdownButton.cpp')
-rw-r--r-- | src/gui/DropdownButton.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/DropdownButton.cpp b/src/gui/DropdownButton.cpp index 5cc9a3d..50a3105 100644 --- a/src/gui/DropdownButton.cpp +++ b/src/gui/DropdownButton.cpp @@ -26,6 +26,9 @@ namespace gsr { } bool DropdownButton::on_event(mgl::Event &event, mgl::Window&, mgl::vec2f offset) { + if(!visible) + return true; + if(event.type == mgl::Event::MouseMoved) { const mgl::vec2f draw_pos = position + offset; const mgl::vec2f collision_margin(1.0f, 1.0f); // Makes sure that multiple buttons that are next to each other wont activate at the same time when the cursor is right between them @@ -56,6 +59,9 @@ namespace gsr { } void DropdownButton::draw(mgl::Window &window, mgl::vec2f offset) { + if(!visible) + return; + update_if_dirty(); const mgl::vec2f draw_pos = position + offset; @@ -199,6 +205,9 @@ namespace gsr { } mgl::vec2f DropdownButton::get_size() { + if(!visible) + return {0.0f, 0.0f}; + update_if_dirty(); return size; } |