Skip to content

Point

Defined in: src/Point.ts:13

Adaptation of work of Kevin Lindsey(kevin@kevlindev.com)

Implements

Constructors

new Point()

new Point(): Point

Defined in: src/Point.ts:18

Returns

Point

new Point()

new Point(x, y): Point

Defined in: src/Point.ts:19

Parameters

x

number

y

number

Returns

Point

new Point()

new Point(point?): Point

Defined in: src/Point.ts:20

Parameters

point?

XY

Returns

Point

Properties

x

x: number

Defined in: src/Point.ts:14

Implementation of

XY.x


y

y: number

Defined in: src/Point.ts:16

Implementation of

XY.y

Methods

add()

add(that): Point

Defined in: src/Point.ts:36

Adds another point to this one and returns another one

Parameters

that

XY

Returns

Point

new Point instance with added values


addEquals()

addEquals(that): Point

Defined in: src/Point.ts:47

Adds another point to this one

Parameters

that

XY

Returns

Point

thisArg

Chainable


clone()

clone(): Point

Defined in: src/Point.ts:347

return a cloned instance of the point

Returns

Point


distanceFrom()

distanceFrom(that): number

Defined in: src/Point.ts:246

Returns distance from this point and another one

Parameters

that

XY

Returns

number


divide()

divide(that): Point

Defined in: src/Point.ts:155

Divides this point by another and returns a new one

Parameters

that

XY

Returns

Point


eq()

eq(that): boolean

Defined in: src/Point.ts:186

Returns true if this point is equal to another one

Parameters

that

XY

Returns

boolean


gt()

gt(that): boolean

Defined in: src/Point.ts:214

Returns true if this point is greater another one

Parameters

that

XY

Returns

boolean


gte()

gte(that): boolean

Defined in: src/Point.ts:223

Returns true if this point is greater than or equal to another one

Parameters

that

XY

Returns

boolean


lerp()

lerp(that, t): Point

Defined in: src/Point.ts:233

Returns new point which is the result of linear interpolation with this one and another one

Parameters

that

XY

t

number = 0.5

, position of interpolation, between 0 and 1 default 0.5

Returns

Point


lt()

lt(that): boolean

Defined in: src/Point.ts:195

Returns true if this point is less than another one

Parameters

that

XY

Returns

boolean


lte()

lte(that): boolean

Defined in: src/Point.ts:204

Returns true if this point is less than or equal to another one

Parameters

that

XY

Returns

boolean


max()

max(that): Point

Defined in: src/Point.ts:275

Returns a new point which is the max of this and another one

Parameters

that

XY

Returns

Point


midPointFrom()

midPointFrom(that): Point

Defined in: src/Point.ts:257

Returns the point between this point and another one

Parameters

that

XY

Returns

Point


min()

min(that): Point

Defined in: src/Point.ts:266

Returns a new point which is the min of this and another one

Parameters

that

XY

Returns

Point


multiply()

multiply(that): Point

Defined in: src/Point.ts:124

Multiplies this point by another value and returns a new one

Parameters

that

XY

Returns

Point


rotate()

rotate(radians, origin): Point

Defined in: src/Point.ts:359

Rotates point around origin with radians

Parameters

radians

TRadian

The radians of the angle for the rotation

origin

XY = ZERO

The origin of the rotation

Returns

Point

The new rotated point

Static

Member Of

fabric.util


scalarAdd()

scalarAdd(scalar): Point

Defined in: src/Point.ts:58

Adds value to this point and returns a new one

Parameters

scalar

number

Returns

Point

new Point with added value


scalarAddEquals()

scalarAddEquals(scalar): Point

Defined in: src/Point.ts:69

Adds value to this point

Parameters

scalar

number

Returns

Point

thisArg

Chainable


scalarDivide()

scalarDivide(scalar): Point

Defined in: src/Point.ts:164

Divides this point by a value and returns a new one

Parameters

scalar

number

Returns

Point


scalarDivideEquals()

scalarDivideEquals(scalar): Point

Defined in: src/Point.ts:175

Divides this point by a value

Parameters

scalar

number

Returns

Point

thisArg

Chainable


scalarMultiply()

scalarMultiply(scalar): Point

Defined in: src/Point.ts:133

Multiplies this point by a value and returns a new one

Parameters

scalar

number

Returns

Point


scalarMultiplyEquals()

scalarMultiplyEquals(scalar): Point

Defined in: src/Point.ts:144

Multiplies this point by a value

Parameters

scalar

number

Returns

Point

thisArg

Chainable


scalarSubtract()

scalarSubtract(scalar): Point

Defined in: src/Point.ts:102

Subtracts value from this point and returns a new one

Parameters

scalar

number

Returns

Point


scalarSubtractEquals()

scalarSubtractEquals(scalar): Point

Defined in: src/Point.ts:113

Subtracts value from this point

Parameters

scalar

number

Returns

Point

thisArg

Chainable


setFromPoint()

setFromPoint(that): Point

Defined in: src/Point.ts:324

Sets x/y of this point from another point

Parameters

that

XY

Returns

Point

Chainable


setX()

setX(x): Point

Defined in: src/Point.ts:304

Sets x of this point

Parameters

x

number

Returns

Point

Chainable


setXY()

setXY(x, y): Point

Defined in: src/Point.ts:293

Sets x/y of this point

Parameters

x

number

y

number

Returns

Point

Chainable


setY()

setY(y): Point

Defined in: src/Point.ts:314

Sets y of this point

Parameters

y

number

Returns

Point

Chainable


subtract()

subtract(that): Point

Defined in: src/Point.ts:80

Subtracts another point from this point and returns a new one

Parameters

that

XY

Returns

Point

new Point object with subtracted values


subtractEquals()

subtractEquals(that): Point

Defined in: src/Point.ts:91

Subtracts another point from this point

Parameters

that

XY

Returns

Point

thisArg

Chainable


swap()

swap(that): void

Defined in: src/Point.ts:334

Swaps x/y of this point and another point

Parameters

that

XY

Returns

void


toString()

toString(): string

Defined in: src/Point.ts:283

Returns string representation of this point

Returns

string


transform()

transform(t, ignoreOffset?): Point

Defined in: src/Point.ts:380

Apply transform t to point p

Parameters

t

TMat2D

The transform

ignoreOffset?

boolean = false

Indicates that the offset should not be applied

Returns

Point

The transformed point

Static

Member Of

fabric.util