diff options
author | crupest <crupest@outlook.com> | 2018-11-07 17:23:43 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-11-07 17:23:43 +0800 |
commit | 9f7de7f0775b86e3c82d4c5e3427a6f2fd98810b (patch) | |
tree | 6184328d03e1963c8897a9e91f2c990dcfae053d /src/ui/layout_base.h | |
parent | df0d6e1e282c75d4d8154011715f0b74547b35db (diff) | |
download | cru-9f7de7f0775b86e3c82d4c5e3427a6f2fd98810b.tar.gz cru-9f7de7f0775b86e3c82d4c5e3427a6f2fd98810b.tar.bz2 cru-9f7de7f0775b86e3c82d4c5e3427a6f2fd98810b.zip |
Improve layout system.
Diffstat (limited to 'src/ui/layout_base.h')
-rw-r--r-- | src/ui/layout_base.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ui/layout_base.h b/src/ui/layout_base.h index 0d924436..662210bd 100644 --- a/src/ui/layout_base.h +++ b/src/ui/layout_base.h @@ -63,6 +63,11 @@ namespace cru return top + bottom; } + float Validate() const + { + return left >= 0.0 && top >= 0.0 && right >= 0.0 && bottom >= 0.0; + } + float left; float top; float right; @@ -96,7 +101,7 @@ namespace cru constexpr bool Validate() const { - return !(mode == MeasureMode::Exactly && length < 0.0); + return length >= 0.0; } float length = 0.0; @@ -115,7 +120,7 @@ namespace cru bool Validate() const { - return width.Validate() && height.Validate(); + return width.Validate() && height.Validate() && margin.Validate() && padding.Validate(); } LayoutSideParams width; |