Skip to content

Commit

Permalink
CanvasItemEditor: Fix losing position for drag'n'dropped scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga committed Jun 22, 2020
1 parent d808697 commit a403131
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6137,6 +6137,11 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons
Vector2 target_pos = canvas_item_editor->get_canvas_transform().affine_inverse().xform(p_point);
target_pos = canvas_item_editor->snap_point(target_pos);
target_pos = parent_ci->get_global_transform_with_canvas().affine_inverse().xform(target_pos);
// Preserve instance position of the original scene.
CanvasItem *instance_ci = Object::cast_to<CanvasItem>(instanced_scene);
if (instance_ci) {
target_pos += instance_ci->_edit_get_position();
}
editor_data->get_undo_redo().add_do_method(instanced_scene, "set_position", target_pos);
}

Expand Down

0 comments on commit a403131

Please sign in to comment.