From fb7a4ce63efe25e288b4d85fa280283be18ed6e9 Mon Sep 17 00:00:00 2001 From: AJ Weeks Date: Sun, 20 Oct 2019 11:11:06 +0100 Subject: Fix canvas scale gizmo placement --- scene/2d/canvas_item.cpp | 5 +++++ scene/2d/canvas_item.h | 2 ++ 2 files changed, 7 insertions(+) (limited to 'scene/2d') diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index b38fbfe981..b4f97a11c9 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -360,6 +360,10 @@ bool CanvasItem::_edit_is_selected_on_click(const Point2 &p_point, double p_tole } } +Transform2D CanvasItem::_edit_get_transform() const { + return Transform2D(_edit_get_rotation(), _edit_get_position() + _edit_get_pivot()); +} + bool CanvasItem::is_visible_in_tree() const { if (!is_inside_tree()) @@ -1120,6 +1124,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("_edit_set_pivot", "pivot"), &CanvasItem::_edit_set_pivot); ClassDB::bind_method(D_METHOD("_edit_get_pivot"), &CanvasItem::_edit_get_pivot); ClassDB::bind_method(D_METHOD("_edit_use_pivot"), &CanvasItem::_edit_use_pivot); + ClassDB::bind_method(D_METHOD("_edit_get_transform"), &CanvasItem::_edit_get_transform); ClassDB::bind_method(D_METHOD("get_canvas_item"), &CanvasItem::get_canvas_item); diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index 9c6799a441..a1724aa532 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -281,6 +281,8 @@ public: virtual void _edit_set_pivot(const Point2 &p_pivot){}; virtual Point2 _edit_get_pivot() const { return Point2(); }; + virtual Transform2D _edit_get_transform() const; + /* VISIBILITY */ void set_visible(bool p_visible); -- cgit v1.2.3