diff options
author | reduz <reduzio@gmail.com> | 2015-12-29 07:31:50 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2015-12-29 07:31:50 -0300 |
commit | 135d5fb06d268e4a493e612bded0a52484714684 (patch) | |
tree | a58b1b8ebc39464f5006cbc76952e01c1929ac6d /tools | |
parent | 4028dfa6d29a2894d2011d24b3300df1cfc4f906 (diff) |
-property change object's rotation pivot on children of scaled CanvasLayer, fixes #2599
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/plugins/canvas_item_editor_plugin.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 6df0a653fa..9213543ff5 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -166,9 +166,11 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2& mouse_pos) { Vector2 offset = n2d->edit_get_pivot(); Vector2 gpos = n2d->get_global_pos(); - Vector2 motion_ofs = gpos-mouse_pos; + Vector2 local_mouse_pos = n2d->get_canvas_transform().affine_inverse().xform(mouse_pos); - undo_redo->add_do_method(n2d,"set_global_pos",mouse_pos); + Vector2 motion_ofs = gpos-local_mouse_pos; + + undo_redo->add_do_method(n2d,"set_global_pos",local_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); |