Skip to content

Commit

Permalink
Prevent warning spam to console when dragging a CanvasItem in container
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaosus committed Aug 1, 2021
1 parent e5411a8 commit bb5729f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2012,11 +2012,13 @@ 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.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;
if (!drag_selection.is_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, nullptr, drag_selection);
Expand Down

0 comments on commit bb5729f

Please sign in to comment.