mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-26 03:12:07 -05:00
LibGfx: Add convenience method Point::constrained
This commit is contained in:
parent
790eacfbd1
commit
a43ba348e1
1 changed files with 7 additions and 1 deletions
|
@ -28,8 +28,8 @@
|
|||
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibGfx/Orientation.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Orientation.h>
|
||||
#include <LibIPC/Forward.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -100,6 +100,12 @@ public:
|
|||
}
|
||||
|
||||
void constrain(const Rect<T>&);
|
||||
Point<T> constrained(const Rect<T>& rect) const
|
||||
{
|
||||
Point<T> point = *this;
|
||||
point.constrain(rect);
|
||||
return point;
|
||||
}
|
||||
|
||||
bool operator==(const Point<T>& other) const
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue