aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/utils/rectangle.hpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/utils/rectangle.hpp b/src/utils/rectangle.hpp
index 7297cf47..5ea2787f 100644
--- a/src/utils/rectangle.hpp
+++ b/src/utils/rectangle.hpp
@@ -144,6 +144,25 @@ namespace usdx
return result;
}
+
+ const Rectangle<T> operator+(const Point<T>& offset)
+ {
+ Rectangle<T> tmp(*this);
+ tmp += offset;
+ return tmp;
+ }
+
+ Rectangle<T>& operator+=(const Point<T>& offset)
+ {
+ T height = this->get_height();
+ T width = this->get_width();
+ T left = this->get_left() + offset.get_x();
+ T top = this->get_top() + offset.get_y();
+
+ this->point1 = Point<T>(left, top);
+ this->point2 = Point<T>(left + width, top + height);
+ return *this;
+ }
};
};