diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/Button.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/gui/Button.cpp b/src/gui/Button.cpp index e8137c9..9662c34 100644 --- a/src/gui/Button.cpp +++ b/src/gui/Button.cpp @@ -18,10 +18,8 @@ namespace gsr { bool Button::on_event(mgl::Event &event, mgl::Window&, mgl::vec2f offset) { const mgl::vec2f item_size = get_size().floor(); - if(event.type == mgl::Event::MouseMoved) { - mouse_inside = mgl::FloatRect(position + offset, item_size).contains({ (float)event.mouse_move.x, (float)event.mouse_move.y }); - } else if(event.type == mgl::Event::MouseButtonPressed && event.mouse_button.button == mgl::Mouse::Left) { - const bool clicked_inside = mgl::FloatRect(position + offset, item_size).contains({ (float)event.mouse_button.x, (float)event.mouse_button.y });; + if(event.type == mgl::Event::MouseButtonPressed && event.mouse_button.button == mgl::Mouse::Left) { + const bool clicked_inside = mgl::FloatRect(position + offset, item_size).contains({ (float)event.mouse_button.x, (float)event.mouse_button.y }); if(clicked_inside && on_click) on_click(); } |