diff options
Diffstat (limited to 'main/app.cpp')
-rw-r--r-- | main/app.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/main/app.cpp b/main/app.cpp index 42246bbd..07271e27 100644 --- a/main/app.cpp +++ b/main/app.cpp @@ -102,22 +102,20 @@ void app::mousePressEvent(Platform::Sdl2Application::MouseEvent& event) { if (_imgui.handleMousePressEvent(event)) return event.setAccepted(); + else if (_cursor_tile) { - if (_cursor_tile) + const auto& tile = *_cursor_tile; + int button; + switch (event.button()) { - const auto& tile = *_cursor_tile; - int button; - switch (event.button()) - { - case MouseEvent::Button::Left: button = 0; break; - case MouseEvent::Button::Right: button = 1; break; - case MouseEvent::Button::Middle: button = 2; break; - case MouseEvent::Button::X1: button = 5; break; - case MouseEvent::Button::X2: button = 6; break; - default: button = -1; break; - } - do_mouse_click(tile, button); + case MouseEvent::Button::Left: button = 0; break; + case MouseEvent::Button::Right: button = 1; break; + case MouseEvent::Button::Middle: button = 2; break; + case MouseEvent::Button::X1: button = 5; break; + case MouseEvent::Button::X2: button = 6; break; + default: button = -1; break; } + do_mouse_click(tile, button); } } |