summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Roudiere <gilles.roudiere@gmail.com>2017-08-18 23:32:23 +0200
committerGilles Roudiere <gilles.roudiere@gmail.com>2017-09-17 23:04:30 +0200
commit100c7888849ed384ef1a4788816cbf3b445ec1eb (patch)
tree5306368df82378fd0b776c6ded7188cf284c642f
parentad1028471c9a8e8c2aeb35d232f259fa007e2c26 (diff)
Display width and height when dragging a node side
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 8a740e0428..fd27f42f04 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2149,7 +2149,7 @@ void CanvasItemEditor::_viewport_draw() {
anchor_handle->draw_rect(ci, anchor_rects[i]);
}
- // Draw the margin values when dragging control side
+ // Draw the margin values and the node width/height when dragging control side
float ratio = 0.33;
Transform2D parent_transform = xform * control->get_transform().affine_inverse();
float node_pos_in_parent[4];
@@ -2162,6 +2162,7 @@ void CanvasItemEditor::_viewport_draw() {
case DRAG_LEFT:
case DRAG_TOP_LEFT:
case DRAG_BOTTOM_LEFT:
+ _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
case DRAG_ALL:
Point2 start = Vector2(node_pos_in_parent[0], Math::lerp(node_pos_in_parent[1], node_pos_in_parent[3], ratio));
Point2 end = start - Vector2(control->get_margin(MARGIN_LEFT), 0);
@@ -2173,6 +2174,7 @@ void CanvasItemEditor::_viewport_draw() {
case DRAG_RIGHT:
case DRAG_TOP_RIGHT:
case DRAG_BOTTOM_RIGHT:
+ _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
case DRAG_ALL:
Point2 start = Vector2(node_pos_in_parent[2], Math::lerp(node_pos_in_parent[3], node_pos_in_parent[1], ratio));
Point2 end = start - Vector2(control->get_margin(MARGIN_RIGHT), 0);
@@ -2184,6 +2186,7 @@ void CanvasItemEditor::_viewport_draw() {
case DRAG_TOP:
case DRAG_TOP_LEFT:
case DRAG_TOP_RIGHT:
+ _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2)) + Vector2(5, 0), MARGIN_RIGHT);
case DRAG_ALL:
Point2 start = Vector2(Math::lerp(node_pos_in_parent[0], node_pos_in_parent[2], ratio), node_pos_in_parent[1]);
Point2 end = start - Vector2(0, control->get_margin(MARGIN_TOP));
@@ -2195,6 +2198,7 @@ void CanvasItemEditor::_viewport_draw() {
case DRAG_BOTTOM:
case DRAG_BOTTOM_LEFT:
case DRAG_BOTTOM_RIGHT:
+ _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2) + Vector2(5, 0)), MARGIN_RIGHT);
case DRAG_ALL:
Point2 start = Vector2(Math::lerp(node_pos_in_parent[2], node_pos_in_parent[0], ratio), node_pos_in_parent[3]);
Point2 end = start - Vector2(0, control->get_margin(MARGIN_BOTTOM));