From 23bf673f9582d7bc99eb6440be1df0cf5c43b725 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 25 Jul 2020 23:57:16 +0800 Subject: Implement ScrollRenderObject::ScrollToContain . --- include/cru/platform/GraphBase.hpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/cru/platform') diff --git a/include/cru/platform/GraphBase.hpp b/include/cru/platform/GraphBase.hpp index 28dab1e6..e476e3cd 100644 --- a/include/cru/platform/GraphBase.hpp +++ b/include/cru/platform/GraphBase.hpp @@ -161,6 +161,12 @@ struct Rect final { constexpr Size GetSize() const { return Size(width, height); } + constexpr Rect Expand(const Thickness& thickness) const { + return Rect(left - thickness.left, top - thickness.top, + width + thickness.GetHorizontalTotal(), + height + thickness.GetVerticalTotal()); + } + constexpr Rect Shrink(const Thickness& thickness) const { return Rect(left + thickness.left, top + thickness.top, width - thickness.GetHorizontalTotal(), -- cgit v1.2.3