diff options
author | Gilles Roudiere <gilles.roudiere@gmail.com> | 2017-08-18 22:56:00 +0200 |
---|---|---|
committer | Gilles Roudiere <gilles.roudiere@gmail.com> | 2017-09-17 23:04:30 +0200 |
commit | ad1028471c9a8e8c2aeb35d232f259fa007e2c26 (patch) | |
tree | d41c2b8e96a19d4cb323f84bae8d64056f87153e /editor/plugins | |
parent | dbc4dbdec1823996f47c303cfd78662c591d0fdd (diff) |
Draw a ghost rect when dragging nodes if it's rotated/scaled
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index b4c2fa34ee..8a740e0428 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2202,6 +2202,24 @@ void CanvasItemEditor::_viewport_draw() { viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1); break; } + + switch (drag) { + //Draw the ghost rect if the node if rotated/scaled + case DRAG_LEFT: + case DRAG_TOP_LEFT: + case DRAG_TOP: + case DRAG_TOP_RIGHT: + case DRAG_RIGHT: + case DRAG_BOTTOM_RIGHT: + case DRAG_BOTTOM: + case DRAG_BOTTOM_LEFT: + case DRAG_ALL: + if (control->get_rotation() != 0.0 || control->get_scale() != Vector2(1, 1)) { + Rect2 rect = Rect2(Vector2(node_pos_in_parent[0], node_pos_in_parent[1]), control->get_size()); + viewport->draw_rect(parent_transform.xform(rect), color_base, false); + } + break; + } } } |