From 9be6fbf5eae8c4b902b818881a4dc34f87bb630d Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sat, 11 Nov 2023 14:37:17 +0000 Subject: decorations: Decoration Positioner (#3800) --- src/helpers/Box.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/helpers/Box.cpp') diff --git a/src/helpers/Box.cpp b/src/helpers/Box.cpp index 55300f5f..29aa81fa 100644 --- a/src/helpers/Box.cpp +++ b/src/helpers/Box.cpp @@ -96,6 +96,15 @@ CBox& CBox::scaleFromCenter(double scale) { return *this; } +CBox& CBox::expand(const double& value) { + x -= value; + y -= value; + w += value * 2.0; + h += value * 2.0; + + return *this; +} + CBox CBox::roundInternal() { float newW = x + w - std::floor(x); float newH = y + h - std::floor(y); @@ -110,3 +119,7 @@ Vector2D CBox::pos() const { Vector2D CBox::size() const { return {w, h}; } + +SWindowDecorationExtents CBox::extentsFrom(const CBox& small) { + return {{small.x - x, small.y - y}, {w - small.w - (small.x - x), h - small.h - (small.y - y)}}; +} -- cgit v1.2.3