diff options
| author | Gilles Roudiere | 2017-08-05 01:55:03 +0200 |
|---|---|---|
| committer | Gilles Roudiere | 2017-08-13 21:20:13 +0200 |
| commit | e76b535a1a3011b17c3b55434391713244ebcb58 (patch) | |
| tree | 0192d09b92ba536a8b3fa810ff75e7c12e9ded7c /scene/gui/control.cpp | |
| parent | e8c83b31bddd1767a828aaed2f34c1a442bd6919 (diff) | |
| download | godot-e76b535a1a3011b17c3b55434391713244ebcb58.tar.gz godot-e76b535a1a3011b17c3b55434391713244ebcb58.tar.zst godot-e76b535a1a3011b17c3b55434391713244ebcb58.zip | |
Diffstat (limited to 'scene/gui/control.cpp')
| -rw-r--r-- | scene/gui/control.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index f7058989a..30ee51fd1 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -51,6 +51,12 @@ Variant Control::edit_get_state() const { s["rect"] = get_rect(); s["rot"] = get_rotation(); s["scale"] = get_scale(); + Array anchors; + anchors.push_back(get_anchor(MARGIN_LEFT)); + anchors.push_back(get_anchor(MARGIN_TOP)); + anchors.push_back(get_anchor(MARGIN_RIGHT)); + anchors.push_back(get_anchor(MARGIN_BOTTOM)); + s["anchors"] = anchors; return s; } void Control::edit_set_state(const Variant &p_state) { @@ -62,6 +68,11 @@ void Control::edit_set_state(const Variant &p_state) { set_size(state.size); set_rotation(s["rot"]); set_scale(s["scale"]); + Array anchors = s["anchors"]; + set_anchor(MARGIN_LEFT, anchors[0]); + set_anchor(MARGIN_TOP, anchors[1]); + set_anchor(MARGIN_RIGHT, anchors[2]); + set_anchor(MARGIN_BOTTOM, anchors[3]); } void Control::set_custom_minimum_size(const Size2 &p_custom) { |
