Skip to content

Commit

Permalink
Merge pull request #62629 from linkpy/master
Browse files Browse the repository at this point in the history
Make the alternative tile control correctly handle right-click dragging.
  • Loading branch information
akien-mga authored Jul 29, 2022
2 parents 0cf26fb + d5926b4 commit 9869182
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion editor/plugins/tiles/tile_set_atlas_source_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit 9869182

Please sign in to comment.