Skip to content

Commit bb32eee

Browse files
author
minggo
authored
make code more clean and make comment more clear (#19155)
1 parent e63e00f commit bb32eee

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

cocos/math/CCGeometry.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,10 @@ float Rect::getMinY() const
175175

176176
bool Rect::containsPoint(const Vec2& point) const
177177
{
178-
bool bRet = false;
179-
180-
if (point.x >= getMinX() && point.x <= getMaxX()
181-
&& point.y >= getMinY() && point.y <= getMaxY())
182-
{
183-
bRet = true;
184-
}
185-
186-
return bRet;
178+
return (point.x >= getMinX() &&
179+
point.x <= getMaxX() &&
180+
point.y >= getMinY() &&
181+
point.y <= getMaxY());
187182
}
188183

189184
bool Rect::intersectsRect(const Rect& rect) const

cocos/math/CCGeometry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class CC_DLL Rect
190190
*/
191191
bool equals(const Rect& rect) const;
192192
/**
193-
Check if the points is contained in the rect.
193+
Check if the points is contained inclusively in the rect.
194194
* @js NA
195195
*/
196196
bool containsPoint(const Vec2& point) const;

0 commit comments

Comments
 (0)