diff options
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); |