summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorGilles Roudiere <gilles.roudiere@gmail.com>2017-08-05 01:55:03 +0200
committerGilles Roudiere <gilles.roudiere@gmail.com>2017-08-13 21:20:13 +0200
commite76b535a1a3011b17c3b55434391713244ebcb58 (patch)
tree0192d09b92ba536a8b3fa810ff75e7c12e9ded7c /scene
parente8c83b31bddd1767a828aaed2f34c1a442bd6919 (diff)
Handle undo/redo of anchor positioning
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/control.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index f7058989a0..30ee51fd15 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) {