summaryrefslogtreecommitdiff
path: root/src/helpers/Box.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/helpers/Box.cpp')
-rw-r--r--src/helpers/Box.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/helpers/Box.cpp b/src/helpers/Box.cpp
index 3d57bc79..d3f5d36c 100644
--- a/src/helpers/Box.cpp
+++ b/src/helpers/Box.cpp
@@ -105,6 +105,13 @@ CBox& CBox::expand(const double& value) {
return *this;
}
+CBox& CBox::noNegativeSize() {
+ std::clamp(w, 0.0, std::numeric_limits<double>::infinity());
+ std::clamp(h, 0.0, std::numeric_limits<double>::infinity());
+
+ return *this;
+}
+
CBox CBox::roundInternal() {
float newW = x + w - std::floor(x);
float newH = y + h - std::floor(y);