mirror of
https://github.com/RGBCube/serenity
synced 2025-06-23 04:42:07 +00: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/Forward.h>
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
#include <LibGfx/Orientation.h>
|
|
||||||
#include <LibGfx/Forward.h>
|
#include <LibGfx/Forward.h>
|
||||||
|
#include <LibGfx/Orientation.h>
|
||||||
#include <LibIPC/Forward.h>
|
#include <LibIPC/Forward.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -100,6 +100,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void constrain(const Rect<T>&);
|
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
|
bool operator==(const Point<T>& other) const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue