Prevent warning spam to console when dragging a CanvasItem in container

(cherry picked from commit bb5729fd35)
This commit is contained in:
Yuri Roubinsky 2021-08-01 12:55:53 +03:00 committed by Rémi Verschelde
parent 5e3ed7e014
commit 73f40a1efc
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 7 additions and 5 deletions

View File

@ -2110,12 +2110,14 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
drag_to = transform.affine_inverse().xform(m->get_position());
Point2 previous_pos;
if (!drag_selection.empty()) {
if (drag_selection.size() == 1) {
Transform2D xform = drag_selection[0]->get_global_transform_with_canvas() * drag_selection[0]->get_transform().affine_inverse();
previous_pos = xform.xform(drag_selection[0]->_edit_get_position());
} else {
previous_pos = _get_encompassing_rect_from_list(drag_selection).position;
}
}
Point2 new_pos = snap_point(previous_pos + (drag_to - drag_from), SNAP_GRID | SNAP_GUIDES | SNAP_PIXEL | SNAP_NODE_PARENT | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES, 0, NULL, drag_selection);
bool single_axis = m->get_shift();
if (single_axis) {