diff options
author | Estelle Linkpy Reid <linkpydev@gmail.com> | 2022-07-02 13:28:02 +0200 |
---|---|---|
committer | Estelle Linkpy Reid <linkpydev@gmail.com> | 2022-07-29 03:11:08 +0200 |
commit | d5926b435e217acee891d875add1dffd5bea79a8 (patch) | |
tree | 2d8d844ee4f2361f090c696ca8b31d8e6167f9aa | |
parent | 8cb51a642e7c34a73e7ed877ab46c041521205e5 (diff) |
Make the alternative tile control correctly handle right-click dragging.
-rw-r--r-- | editor/plugins/tiles/tile_set_atlas_source_editor.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 88bbd7f1dd..f343e30e29 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -1886,6 +1886,12 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_gui_input(const Ref<In tile_atlas_control_unscaled->update(); alternative_tiles_control->update(); alternative_tiles_control_unscaled->update(); + + if (drag_type == DRAG_TYPE_MAY_POPUP_MENU) { + if (Vector2(drag_start_mouse_pos).distance_to(tile_atlas_control->get_local_mouse_position()) > 5.0 * EDSCALE) { + drag_type = DRAG_TYPE_NONE; + } + } } Ref<InputEventMouseButton> mb = p_event; @@ -1911,7 +1917,10 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_gui_input(const Ref<In } } else if (mb->get_button_index() == MouseButton::RIGHT) { if (mb->is_pressed()) { - // Right click pressed + drag_type = DRAG_TYPE_MAY_POPUP_MENU; + drag_start_mouse_pos = alternative_tiles_control->get_local_mouse_position(); + } else if (drag_type == DRAG_TYPE_MAY_POPUP_MENU) { + // Right click released and wasn't dragged too far Vector3 tile = tile_atlas_view->get_alternative_tile_at_pos(mouse_local_pos); selection.clear(); |