From a43ba348e17a07e006543e14ff9189aef457b288 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 5 Aug 2020 05:10:56 -0600 Subject: [PATCH] LibGfx: Add convenience method Point::constrained --- Libraries/LibGfx/Point.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Libraries/LibGfx/Point.h b/Libraries/LibGfx/Point.h index 9603625ef8..6357b9d2b7 100644 --- a/Libraries/LibGfx/Point.h +++ b/Libraries/LibGfx/Point.h @@ -28,8 +28,8 @@ #include #include -#include #include +#include #include #include #include @@ -100,6 +100,12 @@ public: } void constrain(const Rect&); + Point constrained(const Rect& rect) const + { + Point point = *this; + point.constrain(rect); + return point; + } bool operator==(const Point& other) const {