This commit is contained in:
jacekpoz 2024-08-13 13:31:13 +02:00
parent 5142127ae0
commit 4ac6a1bb70
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -127,11 +127,11 @@ inline bool triangle_intersects(const PtkTriangle t, const PtkPos p) {
}
inline bool rect_intersects(const PtkRect r, const PtkPos p) {
const bool intersects_x = r.top_left.x <= p.x
&& r.top_left.x + r.top_left.w >= p.x;
const bool intersects_x = p.x >= r.top_left.x &&
p.x <= r.top_left.x + r.size.w;
const bool intersects_y = r.top_left.y <= p.y
&& r.top_left.y + r.top_left.h >= p.y;
const bool intersects_y = p.y >= r.top_left.y &&
p.y <= r.top_left.y + r.size.h;
return intersects_x && intersects_y;
}