Rect
Defined in: js-api/src/grid.ts:78
Represents a rectangle.
Constructors
Constructor
new Rect(
x,y,width,height):Rect
Defined in: js-api/src/grid.ts:84
Parameters
| Parameter | Type |
|---|---|
x | number |
y | number |
width | number |
height | number |
Returns
Rect
Properties
| Property | Type | Defined in |
|---|---|---|
height | number | js-api/src/grid.ts:82 |
width | number | js-api/src/grid.ts:81 |
x | number | js-api/src/grid.ts:79 |
y | number | js-api/src/grid.ts:80 |
Accessors
bottom
Get Signature
get bottom():
number
Defined in: js-api/src/grid.ts:182
Bottom border position of the rectangle along the y-axis.
Returns
number
left
Get Signature
get left():
number
Defined in: js-api/src/grid.ts:167
Left border position of the rectangle along the x-axis.
Returns
number
maxX
Get Signature
get maxX():
number
Defined in: js-api/src/grid.ts:158
Same as (x + width), or (right)
Returns
number
maxY
Get Signature
get maxY():
number
Defined in: js-api/src/grid.ts:164
Same as (y + height), or (bottom)
Returns
number
midX
Get Signature
get midX():
number
Defined in: js-api/src/grid.ts:145
The midpoint of the rectangle along the x-axis.
Returns
number
midY
Get Signature
get midY():
number
Defined in: js-api/src/grid.ts:150
The midpoint of the rectangle along the y-axis.
Returns
number
minX
Get Signature
get minX():
number
Defined in: js-api/src/grid.ts:155
Same as x
Returns
number
minY
Get Signature
get minY():
number
Defined in: js-api/src/grid.ts:161
Same as (y)
Returns
number
right
Get Signature
get right():
number
Defined in: js-api/src/grid.ts:177
Right border position of the rectangle along the x-axis.
Returns
number
top
Get Signature
get top():
number
Defined in: js-api/src/grid.ts:172
Top border position of the rectangle along the y-axis.
Returns
number
Methods
above()
above(
height):Rect
Defined in: js-api/src/grid.ts:307
New rectangle above the original with a height of height.
Parameters
| Parameter | Type | Description |
|---|---|---|
height | number | {number} new rectangle height |
Returns
Rect
below()
below(
height):Rect
Defined in: js-api/src/grid.ts:301
New rectangle below the original with a height of height.
Parameters
| Parameter | Type | Description |
|---|---|---|
height | number | {number} new rectangle height |
Returns
Rect
contains()
contains(
x,y):boolean
Defined in: js-api/src/grid.ts:454
Checks if this Rect contains the point (x; y) inside
Parameters
| Parameter | Type |
|---|---|
x | number |
y | number |
Returns
boolean
containsPoint()
containsPoint(
p):boolean
Defined in: js-api/src/grid.ts:459
Checks if this Rect contains the specified point
Parameters
| Parameter | Type |
|---|---|
p | Point |
Returns
boolean
cutBottom()
cutBottom(
dh):Rect
Defined in: js-api/src/grid.ts:286
New rectangle with the same top border as the original, but with the bottom border clipped by dh.
Parameters
| Parameter | Type | Description |
|---|---|---|
dh | number | {number} delta height |
Returns
Rect
cutLeft()
cutLeft(
dw):Rect
Defined in: js-api/src/grid.ts:272
New rectangle with the same right border as the original, but with the left border clipped by dw.
Parameters
| Parameter | Type | Description |
|---|---|---|
dw | number | {number} delta width |
Returns
Rect
cutRight()
cutRight(
dw):Rect
Defined in: js-api/src/grid.ts:293
New rectangle with the same left border as the original, but with the right border clipped by dw.
Parameters
| Parameter | Type | Description |
|---|---|---|
dw | number | {number} delta width |
Returns
Rect
cutTop()
cutTop(
dh):Rect
Defined in: js-api/src/grid.ts:279
New rectangle with the same bottom border as the original, but with the top border clipped by dh.
Parameters
| Parameter | Type | Description |
|---|---|---|
dh | number | {number} delta height |
Returns
Rect
fit()
fit(
width,height):Rect
Defined in: js-api/src/grid.ts:447
The biggest rectangle that fits within this rect that keeps the width/height aspect ratio Positioned in the center. Useful for rendering images in cells.
Parameters
| Parameter | Type |
|---|---|
width | number |
height | number |
Returns
Rect
fitSquare()
fitSquare():
Rect
Defined in: js-api/src/grid.ts:439
Square fitted (inscribed) to the original rectangle
Returns
Rect
fromCenterSize()
fromCenterSize(
cx,cy,width,height):Rect
Defined in: js-api/src/grid.ts:140
Parameters
| Parameter | Type |
|---|---|
cx | number |
cy | number |
width | number |
height | number |
Returns
Rect
Deprecated
Use the static Rect.fromCenterSize; this instance form ignores the receiver. Removed in 1.29.
getBottom()
getBottom(
height):Rect
Defined in: js-api/src/grid.ts:207
Rectangle's bottom part of height height. New rectangle with the same bottom border as the original, but with a height of height. The result may be larger than the original rectangle along y-axis.
Parameters
| Parameter | Type | Description |
|---|---|---|
height | number | {number} new rectangle height |
Returns
Rect
getBottomLeft()
getBottomLeft(
width,height):Rect
Defined in: js-api/src/grid.ts:253
New rectangle with the same bottom-left corner as the original, but with new width and height. The result may be larger than the original rectangle on both axes.
Parameters
| Parameter | Type | Description |
|---|---|---|
width | number | {number} new rectangle width |
height | number | {number} new rectangle height |
Returns
Rect
getBottomRight()
getBottomRight(
width,height):Rect
Defined in: js-api/src/grid.ts:263
New rectangle with the same bottom-right corner as the original, but with new width and height. The result may be larger than the original rectangle on both axes.
Parameters
| Parameter | Type | Description |
|---|---|---|
width | number | {number} new rectangle width |
height | number | {number} new rectangle height |
Returns
Rect
getBottomScaled()
getBottomScaled(
ratio):Rect
Defined in: js-api/src/grid.ts:352
New rectangle with the same bottom border as the original, but with a height scaled with ratio of the original height. See also getBottom.
Parameters
| Parameter | Type | Description |
|---|---|---|
ratio | number | {number} height scale factor |
Returns
Rect
getGridPart()
getGridPart(
xCount,yCount,x,y):Rect
Defined in: js-api/src/grid.ts:400
Returns (x, y) part of the original rectangle divided into parts by a grid.
Parameters
| Parameter | Type | Description |
|---|---|---|
xCount | number | {number} dividing grid size along x-axis |
yCount | number | {number} dividing grid size along y-axis |
x | number | {number} index of part to return along x-axis |
y | number | {number} index of part to return along y-axis |
Returns
Rect
getLeft()
getLeft(
width):Rect
Defined in: js-api/src/grid.ts:216
Rectangle's left part of width width. New rectangle with the same left border as the original, but with a width of width. The result may be larger than the original rectangle along x-axis.
Parameters
| Parameter | Type | Description |
|---|---|---|
width | number | {number} new rectangle width |
Returns
Rect
getLeftPart()
getLeftPart(
count,index):Rect
Defined in: js-api/src/grid.ts:388
Vertical part of index of the original rectangle slices on count parts.
Parameters
| Parameter | Type | Description |
|---|---|---|
count | number | {number} count of parts to divide rectangle horizontally |
index | number | {number} index of part to return |
Returns
Rect
getLeftScaled()
getLeftScaled(
ratio):Rect
Defined in: js-api/src/grid.ts:360
New rectangle with the same left border as the original, but with a width scaled with ratio of original width. See also getLeft.
Parameters
| Parameter | Type | Description |
|---|---|---|
ratio | number | {number} width scale factor |
Returns
Rect
getRight()
getRight(
width):Rect
Defined in: js-api/src/grid.ts:225
Rectangle's right part of width width. New rectangle with the same right border as the original, but with a width of width. The result may be larger than the original rectangle along x-axis.
Parameters
| Parameter | Type | Description |
|---|---|---|
width | number | {number} new rectangle width |
Returns
Rect
getRightScaled()
getRightScaled(
ratio):Rect
Defined in: js-api/src/grid.ts:368
New rectangle with the same right border as the original, but with a width scaled with ratio of original width. See also getRight.
Parameters
| Parameter | Type | Description |
|---|---|---|
ratio | number | {number} width scale factor |
Returns
Rect
getTop()
getTop(
height):Rect
Defined in: js-api/src/grid.ts:198
Rectangle's top part of height height. New rectangle with the same top border as the original, but with a height of height. The result may be larger than the original rectangle along y-axis.
Parameters
| Parameter | Type | Description |
|---|---|---|
height | number | {number} new rectangle height |
Returns
Rect
getTopLeft()
getTopLeft(
width,height):Rect
Defined in: js-api/src/grid.ts:234
New rectangle with the same top-left corner as the original, but with new width and height. The result may be larger than the original rectangle on both axes.
Parameters
| Parameter | Type | Description |
|---|---|---|
width | number | {number} new rectangle width |
height | number | {number} new rectangle height |
Returns
Rect
getTopPart()
getTopPart(
count,index):Rect
Defined in: js-api/src/grid.ts:378
Horizontal part of index of the original rectangle sliced on count parts.
Parameters
| Parameter | Type | Description |
|---|---|---|
count | number | {number} count of parts to divide the rectangle vertically |
index | number | {number} index of part to return |
Returns
Rect
getTopRight()
getTopRight(
width,height):Rect
Defined in: js-api/src/grid.ts:243
New rectangle with the same top-right corner as the original, but with new width and height. The result may be larger than the original rectangle on both axes.
Parameters
| Parameter | Type | Description |
|---|---|---|
width | number | {number} new rectangle width |
height | number | {number} new rectangle height |
Returns
Rect
getTopScaled()
getTopScaled(
ratio):Rect
Defined in: js-api/src/grid.ts:344
New rectangle with the same top border as the original, but with a height scaled with ratio of the original height. See also getTop.
Parameters
| Parameter | Type | Description |
|---|---|---|
ratio | number | {number} height scale factor |
Returns
Rect
inflate()
inflate(
dx,dy):Rect
Defined in: js-api/src/grid.ts:414
Inflated rectangle with left and right borders of the original shifted outside by dx and top and bottom borders shifted outside by dy. Overall size increased by 2*dx along x-axis, and by 2*dy along y-axis.
Parameters
| Parameter | Type | Description |
|---|---|---|
dx | number | {number} vertical borders shift delta along x-axis |
dy | number | {number} horizontal borders shift delta along y-axis |
Returns
Rect
inflateRel()
inflateRel(
dxRatio,dyRatio):Rect
Defined in: js-api/src/grid.ts:434
Inflated rectangle with new width scaled by dxRatio of the original and height scaled by dyRatio.
Parameters
| Parameter | Type | Description |
|---|---|---|
dxRatio | number | {number} width scale ratio |
dyRatio | number | {number} height scale ratio |
Returns
Rect
inflateSize()
inflateSize(
dw,dh):Rect
Defined in: js-api/src/grid.ts:425
Inflated rectangle with right border of the original shifted outside by dw and bottom border shifted outside by dh.
Parameters
| Parameter | Type | Description |
|---|---|---|
dw | number | {number} delta width |
dh | number | {number} delta height |
Returns
Rect
move()
move(
dx,dy):Rect
Defined in: js-api/src/grid.ts:189
Moves rectangle by the specified offsets.
Parameters
| Parameter | Type |
|---|---|
dx | number |
dy | number |
Returns
Rect
toDart()
toDart():
any
Defined in: js-api/src/grid.ts:126
Returns
any
toTheBottom()
toTheBottom(
height):Rect
Defined in: js-api/src/grid.ts:334
New rectangle below the original with a height of height. See below.
Parameters
| Parameter | Type | Description |
|---|---|---|
height | number | {number} new rectangle height |
Returns
Rect
toTheLeft()
toTheLeft(
width):Rect
Defined in: js-api/src/grid.ts:313
New rectangle to the left of the original with a width of width.
Parameters
| Parameter | Type | Description |
|---|---|---|
width | number | {number} new rectangle width |
Returns
Rect
toTheRight()
toTheRight(
width):Rect
Defined in: js-api/src/grid.ts:320
New rectangle to the right of the original with a width of width.
Parameters
| Parameter | Type | Description |
|---|---|---|
width | number | {number} new rectangle width |
Returns
Rect
toTheTop()
toTheTop(
height):Rect
Defined in: js-api/src/grid.ts:327
New rectangle above the original with a height of height. See above.
Parameters
| Parameter | Type | Description |
|---|---|---|
height | number | {number} new rectangle height |
Returns
Rect
union()
union(
r):Rect
Defined in: js-api/src/grid.ts:464
Returns a rectangle that contains both this and r.
Parameters
| Parameter | Type |
|---|---|
r | Rect |
Returns
Rect
fromCenterSize()
staticfromCenterSize(cx,cy,width,height):Rect
Defined in: js-api/src/grid.ts:135
Rectangle of the specified size, with the specified center.
Parameters
| Parameter | Type |
|---|---|
cx | number |
cy | number |
width | number |
height | number |
Returns
Rect
fromDart()
staticfromDart(dart):Rect
Defined in: js-api/src/grid.ts:113
Parameters
| Parameter | Type |
|---|---|
dart | any |
Returns
Rect
fromPoints()
staticfromPoints(x1,y1,x2,y2):Rect
Defined in: js-api/src/grid.ts:91
Parameters
| Parameter | Type |
|---|---|
x1 | number |
y1 | number |
x2 | number |
y2 | number |
Returns
Rect
fromXYArrays()
staticfromXYArrays(x,y):Rect
Defined in: js-api/src/grid.ts:97
Parameters
| Parameter | Type |
|---|---|
x | number[] |
y | number[] |
Returns
Rect
toDart()
statictoDart(rect):any
Defined in: js-api/src/grid.ts:118
Parameters
| Parameter | Type |
|---|---|
rect | Rect |
Returns
any