summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorAJ Weeks <ajweeks@shaw.ca>2019-10-20 11:11:06 +0100
committerAJ Weeks <ajweeks@shaw.ca>2019-10-22 18:17:54 +0100
commitfb7a4ce63efe25e288b4d85fa280283be18ed6e9 (patch)
tree6b6a0a27c9773e6d21bc28b191c1b0e6743d42fb /scene/2d
parent119bf237209414a49879fba40459f22315ab1467 (diff)
Fix canvas scale gizmo placement
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/canvas_item.cpp5
-rw-r--r--scene/2d/canvas_item.h2
2 files changed, 7 insertions, 0 deletions
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);