diff --git a/src/ptk_vk/components.c b/src/ptk_vk/components.c index bcd0759..c96c688 100644 --- a/src/ptk_vk/components.c +++ b/src/ptk_vk/components.c @@ -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; }