new RectUtils()
Utility methods about 2D rectangle.
Rectangle is a region defined by left, top, width and height.
- Source:
Methods
-
(static) clone(rect) → {Hash}
-
Clone a rect object.
Parameters:
Name Type Description rect
Hash - Source:
Returns:
- Type
- Hash
-
(static) convertToBox(rect) → {Hash}
-
Convert a rect to a box defined by two coords.
Parameters:
Name Type Description rect
Hash - Source:
Returns:
- Type
- Hash
-
(static) createRect() → {Hash}
-
Create a rect object.
- Source:
Returns:
- Type
- Hash
-
(static) getContainerRect(rect1, rect2) → {Hash}
-
Get the smallest big rect that contains rect1 and rect2.
Parameters:
Name Type Description rect1
Hash rect2
Hash - Source:
Returns:
- Type
- Hash
-
(static) getIntersection(rect1, rect2) → {Hash}
-
Returns intersection of two rects.
Parameters:
Name Type Description rect1
Hash rect2
Hash - Source:
Returns:
- Type
- Hash
-
(static) hasIntersection(rect1, rect2) → {Bool}
-
Check if two rects has intersection.
Parameters:
Name Type Description rect1
Hash rect2
Hash - Source:
Returns:
- Type
- Bool
-
(static) inflateRect(rect, inflateX, inflateY) → {Hash}
-
Inflate the size of rect. Top left coord of rect will not change. X/Y may have different inflation. If only one inflation value is provided, the rect will be use this value on both width and height.
Parameters:
Name Type Description rect
Hash inflateX
Float inflateY
Float - Source:
Returns:
- Type
- Hash
-
(static) isZero(rect)
-
Returns if the width/height of rect is zero
Parameters:
Name Type Description rect
- Source:
-
(static) shiftRect(rect, deltaX, deltaY) → {Hash}
-
Change the top and left value of rect.
Parameters:
Name Type Description rect
Hash deltaX
Float deltaY
Float - Source:
Returns:
- Type
- Hash