Class: Point

fabric.Point

fabric.Point

Constructor

new Point(x, y) → {fabric.Point}

Point class
Parameters:
Name Type Description
x Number
y Number
Source:
Returns:
thisArg
Type
fabric.Point

Methods

add(that) → {fabric.Point}

Adds another point to this one and returns another one
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
new Point instance with added values
Type
fabric.Point

addEquals(that) → {fabric.Point}

Adds another point to this one
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
thisArg
Type
fabric.Point

clone() → {fabric.Point}

return a cloned instance of the point
Source:
Returns:
Type
fabric.Point

distanceFrom(that) → {Number}

Returns distance from this point and another one
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
Type
Number

divide(scalar) → {fabric.Point}

Divides this point by a value and returns a new one TODO: rename in scalarDivide in 2.0
Parameters:
Name Type Description
scalar Number
Source:
Returns:
Type
fabric.Point

divideEquals(scalar) → {fabric.Point}

Divides this point by a value TODO: rename in scalarDivideEquals in 2.0
Parameters:
Name Type Description
scalar Number
Source:
Returns:
thisArg
Type
fabric.Point

eq(that) → {Boolean}

Returns true if this point is equal to another one
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
Type
Boolean

gt(that) → {Boolean}

Returns true if this point is greater another one
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
Type
Boolean

gte(that) → {Boolean}

Returns true if this point is greater than or equal to another one
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
Type
Boolean

lerp(that, t) → {fabric.Point}

Returns new point which is the result of linear interpolation with this one and another one
Parameters:
Name Type Description
that fabric.Point
t Number , position of interpolation, between 0 and 1 default 0.5
Source:
Returns:
Type
fabric.Point

lt(that) → {Boolean}

Returns true if this point is less than another one
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
Type
Boolean

lte(that) → {Boolean}

Returns true if this point is less than or equal to another one
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
Type
Boolean

max(that) → {fabric.Point}

Returns a new point which is the max of this and another one
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
Type
fabric.Point

midPointFrom(that) → {fabric.Point}

Returns the point between this point and another one
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
Type
fabric.Point

min(that) → {fabric.Point}

Returns a new point which is the min of this and another one
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
Type
fabric.Point

multiply(scalar) → {fabric.Point}

Multiplies this point by a value and returns a new one TODO: rename in scalarMultiply in 2.0
Parameters:
Name Type Description
scalar Number
Source:
Returns:
Type
fabric.Point

multiplyEquals(scalar) → {fabric.Point}

Multiplies this point by a value TODO: rename in scalarMultiplyEquals in 2.0
Parameters:
Name Type Description
scalar Number
Source:
Returns:
thisArg
Type
fabric.Point

scalarAdd(scalar) → {fabric.Point}

Adds value to this point and returns a new one
Parameters:
Name Type Description
scalar Number
Source:
Returns:
new Point with added value
Type
fabric.Point

scalarAddEquals(scalar) → {fabric.Point}

Adds value to this point
Parameters:
Name Type Description
scalar Number
Source:
Returns:
thisArg
Type
fabric.Point

scalarSubtract(scalar) → {fabric.Point}

Subtracts value from this point and returns a new one
Parameters:
Name Type Description
scalar Number
Source:
Returns:
Type
fabric.Point

scalarSubtractEquals(scalar) → {fabric.Point}

Subtracts value from this point
Parameters:
Name Type Description
scalar Number
Source:
Returns:
thisArg
Type
fabric.Point

setFromPoint(that)

Sets x/y of this point from another point
Parameters:
Name Type Description
that fabric.Point
Source:

setX(x)

Sets x of this point
Parameters:
Name Type Description
x Number
Source:

setXY(x, y)

Sets x/y of this point
Parameters:
Name Type Description
x Number
y Number
Source:

setY(y)

Sets y of this point
Parameters:
Name Type Description
y Number
Source:

subtract(that) → {fabric.Point}

Subtracts another point from this point and returns a new one
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
new Point object with subtracted values
Type
fabric.Point

subtractEquals(that) → {fabric.Point}

Subtracts another point from this point
Parameters:
Name Type Description
that fabric.Point
Source:
Returns:
thisArg
Type
fabric.Point

swap(that)

Swaps x/y of this point and another point
Parameters:
Name Type Description
that fabric.Point
Source:

toString() → {String}

Returns string representation of this point
Source:
Returns:
Type
String