summaryrefslogtreecommitdiff
path: root/src/helpers/Region.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-05-05 22:18:10 +0100
committerVaxry <43317083+vaxerski@users.noreply.github.com>2024-05-09 13:37:39 +0100
commited411f53bdcf8d455f9e6ca769693aa84dc8372f (patch)
treeaacedb349acdd1022975d7b622dc7cfe11388223 /src/helpers/Region.cpp
parente4e84064f2d07810e0c150bce1369a0a00503e9a (diff)
cursor: move to a hyprland impl
This moves wlr_cursor to a completely new impl mostly under CPointerManager Also adds beginSimple to OpenGL for simple render passes (e.g. cursor)
Diffstat (limited to 'src/helpers/Region.cpp')
-rw-r--r--src/helpers/Region.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/helpers/Region.cpp b/src/helpers/Region.cpp
index bcbf672d..20eaf452 100644
--- a/src/helpers/Region.cpp
+++ b/src/helpers/Region.cpp
@@ -142,6 +142,9 @@ bool CRegion::empty() const {
}
Vector2D CRegion::closestPoint(const Vector2D& vec) const {
+ if (containsPoint(vec))
+ return vec;
+
double bestDist = __FLT_MAX__;
Vector2D leader = vec;
@@ -162,7 +165,7 @@ Vector2D CRegion::closestPoint(const Vector2D& vec) const {
else
y = vec.y;
- double distance = sqrt(pow(x, 2) + pow(y, 2));
+ double distance = pow(x, 2) + pow(y, 2);
if (distance < bestDist) {
bestDist = distance;
leader = {x, y};