From 2b0993885c1304ca3ad26f4873498da14b4d2657 Mon Sep 17 00:00:00 2001 From: Bruno Van de Velde Date: Wed, 20 Sep 2017 13:16:17 +0200 Subject: [PATCH] :sparkles: Layouts now translate '100%' to '&.size' instead of '1 * &.size' --- src/TGUI/Layout.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/TGUI/Layout.cpp b/src/TGUI/Layout.cpp index 7a19fe90..a6089244 100644 --- a/src/TGUI/Layout.cpp +++ b/src/TGUI/Layout.cpp @@ -52,9 +52,17 @@ namespace tgui if (expression.back() == '%') { // We don't know if we have to bind the width or height, so bind "size" and let the connectWidget function figure it out later - *this = Layout{Layout::Operation::Multiplies, - make_unique(tgui::stof(expression.substr(0, expression.length()-1)) / 100.f), - make_unique("&.size")}; + if (expression == "100%") + { + m_boundString = "&.size"; + m_operation = Operation::BindingString; + } + else // value is a fraction of parent size + { + *this = Layout{Layout::Operation::Multiplies, + make_unique(tgui::stof(expression.substr(0, expression.length()-1)) / 100.f), + make_unique("&.size")}; + } } else {