diff options
Diffstat (limited to 'editor/update.cpp')
-rw-r--r-- | editor/update.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/editor/update.cpp b/editor/update.cpp index 567b10e6..b96d80fe 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -43,13 +43,21 @@ void app::do_mouse_move(int mods) void app::do_mouse_up_down(std::uint8_t button, bool is_down, int mods) { - if (cursor.tile && !cursor.in_imgui && button == mouse_button_left && is_down) - _editor.on_click(M->world(), *cursor.tile, mods); - else + if (cursor.tile && !cursor.in_imgui && is_down) { - _editor.on_release(); - update_cursor_tile(cursor.pixel); + auto& w = M->world(); + auto pos = *cursor.tile; + switch (button) + { + case mouse_button_left: + return _editor.on_click(w, pos, mods, editor::button::place); + case mouse_button_middle: + return _editor.on_click(w, pos, mods, editor::button::remove); + default: break; + } } + _editor.on_release(); + update_cursor_tile(cursor.pixel); } void app::do_key(key k, int mods) |