diff options
author | Gilles Roudiere <gilles.roudiere@gmail.com> | 2017-07-06 09:16:27 +0200 |
---|---|---|
committer | Gilles Roudiere <gilles.roudiere@gmail.com> | 2017-08-13 21:20:13 +0200 |
commit | 0d35d4d53b12197bea3650293bbc342fc0b57139 (patch) | |
tree | afd384ffb3f6a8511fb7f052a0ef7da7256bfc05 /scene/gui/popup.cpp | |
parent | 9575dbdf788e8a5154b3ec2f66913e731ac02850 (diff) |
Replace GUI anchor type by a float between 0 and 1
Diffstat (limited to 'scene/gui/popup.cpp')
-rw-r--r-- | scene/gui/popup.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 8979e0f111..bdd0e8e597 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -108,13 +108,10 @@ void Popup::set_as_minsize() { float margin_begin = c->get_margin(m_beg); float margin_end = c->get_margin(m_end); - AnchorType anchor_begin = c->get_anchor(m_beg); - AnchorType anchor_end = c->get_anchor(m_end); + float anchor_begin = c->get_anchor(m_beg); + float anchor_end = c->get_anchor(m_end); - if (anchor_begin == ANCHOR_BEGIN) - minsize[j] += margin_begin; - if (anchor_end == ANCHOR_END) - minsize[j] += margin_end; + minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end; } total_minsize.width = MAX(total_minsize.width, minsize.width); @@ -145,13 +142,10 @@ void Popup::popup_centered_minsize(const Size2 &p_minsize) { float margin_begin = c->get_margin(m_beg); float margin_end = c->get_margin(m_end); - AnchorType anchor_begin = c->get_anchor(m_beg); - AnchorType anchor_end = c->get_anchor(m_end); + float anchor_begin = c->get_anchor(m_beg); + float anchor_end = c->get_anchor(m_end); - if (anchor_begin == ANCHOR_BEGIN) - minsize[j] += margin_begin; - if (anchor_end == ANCHOR_END) - minsize[j] += margin_end; + minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end; } total_minsize.width = MAX(total_minsize.width, minsize.width); |