diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-10 22:25:45 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-10 22:25:45 -0300 |
commit | 6671670e8162bc2dba1382a7b50f1c089ca3df17 (patch) | |
tree | c674668d2a678d6d8fe56e638ed5b5b5bf06a57a /tools | |
parent | 0acd4fccd566fdb074aebac01046b1e80c64b2dc (diff) | |
parent | f271591ac22bd07e1b2316448dd6e9af879c218f (diff) |
Merge pull request #7445 from tagcup/2d_math_fixes
Various corrections in 2D math.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/plugins/canvas_item_editor_plugin.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 531be2d195..74a80abbec 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -1601,10 +1601,8 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { if (node) { - Matrix32 rot; - rot.elements[1] = (dfrom - center).normalized(); - rot.elements[0] = rot.elements[1].tangent(); - node->set_rotation(snap_angle(rot.xform_inv(dto-center).angle() + node->get_rotation(), node->get_rotation())); + real_t angle = node->get_rotation(); + node->set_rotation(snap_angle( angle + (dfrom - center).angle_to(dto-center), angle )); display_rotate_to = dto; display_rotate_from = center; viewport->update(); @@ -1616,10 +1614,8 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { if (node) { - Matrix32 rot; - rot.elements[1] = (dfrom - center).normalized(); - rot.elements[0] = rot.elements[1].tangent(); - node->set_rotation(snap_angle(rot.xform_inv(dto-center).angle() + node->get_rotation(), node->get_rotation())); + real_t angle = node->get_rotation(); + node->set_rotation(snap_angle( angle + (dfrom - center).angle_to(dto-center), angle )); display_rotate_to = dto; display_rotate_from = center; viewport->update(); |