RectGeometry
Rectangle geometry structure
Rect represents a rectangle with position and size, used for drawing operations.
Use Rect to define:
Examples
javascript
let rect = new Rect(10, 20, 100, 50);
console.log(rect.x, rect.y, rect.width, rect.height);javascript
let rect = new Rect(10, 20, 100, 50);
console.log(rect.minX, rect.minY); // 10, 20
console.log(rect.maxX, rect.maxY); // 110, 70Properties
x
- Type:
CGFloat
X coordinate of the rectangle origin
javascript
rect.xy
- Type:
CGFloat
Y coordinate of the rectangle origin
javascript
rect.ywidth
- Type:
CGFloat
Width of the rectangle
javascript
rect.widthheight
- Type:
CGFloat
Height of the rectangle
javascript
rect.heightminX
- Type:
CGFloat
Minimum X coordinate (same as x)
javascript
rect.minXminY
- Type:
CGFloat
Minimum Y coordinate (same as y)
javascript
rect.minYmaxX
- Type:
CGFloat
Maximum X coordinate (x + width)
javascript
rect.maxXmaxY
- Type:
CGFloat
Maximum Y coordinate (y + height)
javascript
rect.maxYorigin
- Type:
[String: CGFloat]
Origin point as dictionary
javascript
rect.origin returns {x, y}size
- Type:
[String: CGFloat]
Size as dictionary
javascript
rect.size returns {width, height}