From 669f5c994b5fe9fb870eae5db86b231202361617 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 16 Jun 2015 16:15:01 -0300 Subject: [PATCH] fix "v" pivot adjust function --- tools/editor/plugins/canvas_item_editor_plugin.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 74b8202dc02..f2738f0a62c 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -175,11 +175,21 @@ void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { Vector2 offset = n2d->edit_get_pivot(); Vector2 gpos = n2d->get_global_pos(); + Vector2 motion_ofs = gpos-mouse_pos; undo_redo->add_do_method(n2d,"set_global_pos",mouse_pos); - undo_redo->add_do_method(n2d,"edit_set_pivot",offset+(gpos-mouse_pos)); + undo_redo->add_do_method(n2d,"edit_set_pivot",offset+n2d->get_global_transform().affine_inverse().basis_xform(motion_ofs)); undo_redo->add_undo_method(n2d,"set_global_pos",gpos); undo_redo->add_undo_method(n2d,"edit_set_pivot",offset); + for(int i=0;iget_child_count();i++) { + Node2D *n2dc = n2d->get_child(i)->cast_to(); + if (!n2dc) + continue; + + undo_redo->add_do_method(n2dc,"set_global_pos",n2dc->get_global_pos()); + undo_redo->add_undo_method(n2dc,"set_global_pos",n2dc->get_global_pos()); + + } }