summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorMarcel Admiraal <madmiraal@users.noreply.github.com>2020-12-07 19:58:47 +0000
committerMarcel Admiraal <madmiraal@users.noreply.github.com>2020-12-08 11:57:46 +0000
commitd5d99aaed6fc2d852491f3c133eacb762656ac4c (patch)
treec7fef424c8730be193b799f7c6d478435ed66118 /editor/plugins
parent0f6745b6aabdab534049e8d1d49f8ddd41fcd1cb (diff)
Use rectangle size instead of extents for Shape dimensions
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp
index 105ac24950..a1a38ca324 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp
@@ -98,7 +98,7 @@ Variant CollisionShape2DEditor::get_handle_value(int idx) const {
Ref<RectangleShape2D> rect = node->get_shape();
if (idx < 3) {
- return rect->get_extents().abs();
+ return rect->get_size().abs();
}
} break;
@@ -179,13 +179,13 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) {
if (idx < 3) {
Ref<RectangleShape2D> rect = node->get_shape();
- Vector2 extents = rect->get_extents();
+ Vector2 size = rect->get_size();
if (idx == 2) {
- extents = p_point;
+ size = p_point * 2;
} else {
- extents[idx] = p_point[idx];
+ size[idx] = p_point[idx] * 2;
}
- rect->set_extents(extents.abs());
+ rect->set_size(size.abs());
canvas_item_editor->update_viewport();
}
@@ -279,9 +279,9 @@ void CollisionShape2DEditor::commit_handle(int idx, Variant &p_org) {
case RECTANGLE_SHAPE: {
Ref<RectangleShape2D> rect = node->get_shape();
- undo_redo->add_do_method(rect.ptr(), "set_extents", rect->get_extents());
+ undo_redo->add_do_method(rect.ptr(), "set_size", rect->get_size());
undo_redo->add_do_method(canvas_item_editor, "update_viewport");
- undo_redo->add_undo_method(rect.ptr(), "set_extents", p_org);
+ undo_redo->add_undo_method(rect.ptr(), "set_size", p_org);
undo_redo->add_undo_method(canvas_item_editor, "update_viewport");
} break;
@@ -493,7 +493,7 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
Ref<RectangleShape2D> shape = node->get_shape();
handles.resize(3);
- Vector2 ext = shape->get_extents();
+ Vector2 ext = shape->get_size() / 2;
handles.write[0] = Point2(ext.x, 0);
handles.write[1] = Point2(0, ext.y);
handles.write[2] = Point2(ext.x, ext.y);