Ir al contenido

Rect

Defined in: geometry/Rect.ts:7

A 2D rectangle defined by position (x, y) and size (width, height).

new Rect(x, y, width, height): Rect

Defined in: geometry/Rect.ts:13

number

number

number

number

Rect

height: number

Defined in: geometry/Rect.ts:11


width: number

Defined in: geometry/Rect.ts:10


x: number

Defined in: geometry/Rect.ts:8


y: number

Defined in: geometry/Rect.ts:9

get bottom(): number

Defined in: geometry/Rect.ts:194

Get the bottom edge y coordinate.

number


get bottomLeft(): object

Defined in: geometry/Rect.ts:134

Get the bottom-left corner.

object

x: number

y: number


get bottomRight(): object

Defined in: geometry/Rect.ts:139

Get the bottom-right corner.

object

x: number

y: number


get center(): object

Defined in: geometry/Rect.ts:144

Get the center point.

object

x: number

y: number


get centerX(): number

Defined in: geometry/Rect.ts:149

GoJS-compatible: The x coordinate of the center of this rect.

number


get centerY(): number

Defined in: geometry/Rect.ts:154

GoJS-compatible: The y coordinate of the center of this rect.

number


get left(): number

Defined in: geometry/Rect.ts:179

Get the left edge x coordinate.

number


get position(): Point

Defined in: geometry/Rect.ts:159

GoJS-compatible: The position (top-left) as a Point.

Point

set position(pos): void

Defined in: geometry/Rect.ts:163

Point

void


get right(): number

Defined in: geometry/Rect.ts:184

Get the right edge x coordinate.

number


get size(): Size

Defined in: geometry/Rect.ts:169

GoJS-compatible: The size as a Size.

Size

set size(size): void

Defined in: geometry/Rect.ts:173

Size

void


get top(): number

Defined in: geometry/Rect.ts:189

Get the top edge y coordinate.

number


get topLeft(): object

Defined in: geometry/Rect.ts:124

Get the top-left corner.

object

x: number

y: number


get topRight(): object

Defined in: geometry/Rect.ts:129

Get the top-right corner.

object

x: number

y: number

area(): number

Defined in: geometry/Rect.ts:199

Get the area.

number


clone(): Rect

Defined in: geometry/Rect.ts:69

Return a copy of this rect.

Rect


computeSides(margin): Rect

Defined in: geometry/Rect.ts:91

GoJS-compatible: Inset the rect on all sides by a margin value or {left,top,right,bottom}.

number | { bottom: number; left: number; right: number; top: number; }

Rect


containsPoint(point): boolean

Defined in: geometry/Rect.ts:214

Check if this rect contains a point.

number

number

boolean


containsRect(other): boolean

Defined in: geometry/Rect.ts:224

Check if this rect contains another rect.

Rect

boolean


copy(): Rect

Defined in: geometry/Rect.ts:74

GoJS-compatible: Return a copy of this rect.

Rect


deflate(dx, dy?): Rect

Defined in: geometry/Rect.ts:290

Shrink this rect by the given margin on all sides.

number

number

Rect


equals(other): boolean

Defined in: geometry/Rect.ts:49

Check if this rect equals another rect.

Rect

boolean


equalsApprox(other, tolerance?): boolean

Defined in: geometry/Rect.ts:59

Check if this rect is approximately equal to another within a tolerance.

Rect

number = 0.0001

boolean


grow(s): Rect

Defined in: geometry/Rect.ts:271

GoJS-compatible: Expand this rect by the given amount on all sides.

number

Rect


inflate(dx, dy?): Rect

Defined in: geometry/Rect.ts:265

Expand this rect by the given margin on all sides.

number

number

Rect


intersection(other): Rect | null

Defined in: geometry/Rect.ts:244

Get the intersection of this rect with another rect.

Rect

Rect | null


intersects(other): boolean

Defined in: geometry/Rect.ts:234

Check if this rect intersects another rect.

Rect

boolean


isEmpty(): boolean

Defined in: geometry/Rect.ts:209

Check if this rect is empty (zero width or height).

boolean


isReal(): boolean

Defined in: geometry/Rect.ts:79

GoJS-compatible: Whether the rect has finite, non-negative dimensions.

boolean


offset(dx, dy): Rect

Defined in: geometry/Rect.ts:295

Offset this rect by the given amounts.

number

number

Rect


perimeter(): number

Defined in: geometry/Rect.ts:204

Get the perimeter.

number


relativeTo(spot): Point

Defined in: geometry/Rect.ts:107

GoJS-compatible: Compute the point in this rect for the given spot.

number

number

number

number

Point


setTo(x, y, width, height): this

Defined in: geometry/Rect.ts:115

GoJS-compatible: In-place mutation returning this rect.

number

number

number

number

this


setToPosition(pos): this

Defined in: geometry/Rect.ts:276

GoJS-compatible: In-place mutation of position returning this rect.

Point

this


setToSize(size): this

Defined in: geometry/Rect.ts:283

GoJS-compatible: In-place mutation of size returning this rect.

Size

this


toJSON(): object

Defined in: geometry/Rect.ts:300

Convert to a plain object.

object

height: number

width: number

x: number

y: number


toString(): string

Defined in: geometry/Rect.ts:310

string


union(other): Rect

Defined in: geometry/Rect.ts:256

Get the smallest rect that contains both rects.

Rect

Rect


static fromCorners(a, b): Rect

Defined in: geometry/Rect.ts:26

Create a Rect from two corner points.

Point

Point

Rect


static fromJSON(data): Rect

Defined in: geometry/Rect.ts:305

Create a Rect from a JSON string or object.

string | { height: number; width: number; x: number; y: number; }

Rect


static fromPosAndSize(pos, size): Rect

Defined in: geometry/Rect.ts:21

Create a Rect from position and size.

Point

Size

Rect


static parse(value): Rect

Defined in: geometry/Rect.ts:40

GoJS-compatible: Parse a string like “x, y, w, h” or “x y w h”.

string

Rect


static zero(): Rect

Defined in: geometry/Rect.ts:35

Create a zero rect at origin.

Rect