From 9109e41a20a202e405cefc4ca6cb54208366fee9 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 8 Feb 2016 11:29:32 -0300 Subject: [PATCH] Property handle rotated controls in 2D editor, fixes #3613 --- scene/gui/control.cpp | 9 +++++++-- scene/resources/sample.cpp | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index c319e306e08..af3b37bec24 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -85,9 +85,14 @@ Size2 Control::edit_get_minimum_size() const { void Control::edit_set_rect(const Rect2& p_edit_rect) { - Rect2 new_rect=get_rect(); + Matrix32 postxf; + postxf.set_rotation_and_scale(data.rotation,data.scale); + Vector2 new_pos = postxf.xform(p_edit_rect.pos); - new_rect.pos+=p_edit_rect.pos.snapped(Vector2(1,1)); + Vector2 pos = get_pos()+new_pos; + + Rect2 new_rect=get_rect(); + new_rect.pos=pos.snapped(Vector2(1,1)); new_rect.size=p_edit_rect.size.snapped(Vector2(1,1)); set_pos(new_rect.pos); diff --git a/scene/resources/sample.cpp b/scene/resources/sample.cpp index 4b25a2c490b..87fcfc425da 100644 --- a/scene/resources/sample.cpp +++ b/scene/resources/sample.cpp @@ -151,8 +151,8 @@ void Sample::set_loop_format(LoopFormat p_format) { if (sample.is_valid()) AudioServer::get_singleton()->sample_set_loop_format(sample,(AudioServer::SampleLoopFormat)p_format); loop_format=p_format; - } + Sample::LoopFormat Sample::get_loop_format() const { return loop_format;