diff --git a/libs/kimath/include/math/box2.h b/libs/kimath/include/math/box2.h
index 00f4d5ab7b..5076cae389 100644
--- a/libs/kimath/include/math/box2.h
+++ b/libs/kimath/include/math/box2.h
@@ -855,8 +855,8 @@ public:
         me.Normalize(); // ensure size is >= 0
 
         // Determine closest point to the circle centre within this rect
-        const coord_type nx = std::clamp( me.GetLeft(), aPoint.x, me.GetRight() );
-        const coord_type ny = std::clamp( me.GetTop(), aPoint.y, me.GetBottom() );
+        const coord_type nx = std::clamp( aPoint.x, me.GetLeft(), me.GetRight() );
+        const coord_type ny = std::clamp( aPoint.y, me.GetTop(), me.GetBottom() );
 
         return Vec( nx, ny );
     }