summaryrefslogtreecommitdiff
path: root/src/helpers/Box.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2023-11-11 14:37:17 +0000
committerGitHub <noreply@github.com>2023-11-11 14:37:17 +0000
commit9be6fbf5eae8c4b902b818881a4dc34f87bb630d (patch)
treea5d440cd8f5d57a659df670548263eba1cd93a0a /src/helpers/Box.cpp
parent7345b1a1ea2671953df48c8a18524a7e556d383c (diff)
decorations: Decoration Positioner (#3800)
Diffstat (limited to 'src/helpers/Box.cpp')
-rw-r--r--src/helpers/Box.cpp13
1 files changed, 13 insertions, 0 deletions
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)}};
+}