diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-01-19 09:39:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-19 09:39:33 +0100 |
commit | 632ff1634b03dda3a7e7086e6bf465874fd07acb (patch) | |
tree | 8a133eb5d0d699f9fd2c81475037f4d3ed0dd9b0 /editor | |
parent | 953432f4b6eb7678f71ed0ddf90b27ad93fac577 (diff) | |
parent | 056ea997e5c4d2150b02a2bb59ea505b697607a1 (diff) |
Merge pull request #25110 from groud/display_pivot
Displays the pivot all the time and rotate the icon
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 86d6799b19..02f6263887 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2738,8 +2738,14 @@ void CanvasItemEditor::_draw_selection() { if (single && (tool == TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_SCALE || tool == TOOL_ROTATE || tool == TOOL_EDIT_PIVOT)) { //kind of sucks // Draw the pivot - if (canvas_item->_edit_get_pivot() != Vector2() || drag_type == DRAG_PIVOT || tool == TOOL_EDIT_PIVOT) { // This is not really clean :/ - viewport->draw_texture(pivot_icon, (xform.xform(canvas_item->_edit_get_pivot()) - (pivot_icon->get_size() / 2)).floor()); + if (canvas_item->_edit_use_pivot()) { + + // Draw the node's pivot + Transform2D unscaled_transform = (xform * canvas_item->get_transform().affine_inverse() * Transform2D(canvas_item->_edit_get_rotation(), canvas_item->_edit_get_position())).orthonormalized(); + Transform2D simple_xform = viewport->get_transform() * unscaled_transform; + viewport->draw_set_transform_matrix(simple_xform); + viewport->draw_texture(pivot_icon, canvas_item->_edit_get_pivot() - (pivot_icon->get_size() / 2).floor()); + viewport->draw_set_transform_matrix(viewport->get_transform()); } // Draw control-related helpers |