Constructor
new Point(x, y) → {fabric.Point}
Point class
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | |
y |
Number |
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 |
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 |
Returns:
thisArg
- Type
- fabric.Point
clone() → {fabric.Point}
return a cloned instance of the point
Returns:
- Type
- fabric.Point
distanceFrom(that) → {Number}
Returns distance from this point and another one
Parameters:
Name | Type | Description |
---|---|---|
that |
fabric.Point |
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 |
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 |
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 |
Returns:
- Type
- Boolean
gt(that) → {Boolean}
Returns true if this point is greater another one
Parameters:
Name | Type | Description |
---|---|---|
that |
fabric.Point |
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 |
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 |
Returns:
- Type
- fabric.Point
lt(that) → {Boolean}
Returns true if this point is less than another one
Parameters:
Name | Type | Description |
---|---|---|
that |
fabric.Point |
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 |
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 |
Returns:
- Type
- fabric.Point
midPointFrom(that) → {fabric.Point}
Returns the point between this point and another one
Parameters:
Name | Type | Description |
---|---|---|
that |
fabric.Point |
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 |
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 |
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 |
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 |
Returns:
new Point with added value
- Type
- fabric.Point
scalarAddEquals(scalar) → {fabric.Point}
Adds value to this point
Parameters:
Name | Type | Description |
---|---|---|
scalar |
Number |
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 |
Returns:
- Type
- fabric.Point
scalarSubtractEquals(scalar) → {fabric.Point}
Subtracts value from this point
Parameters:
Name | Type | Description |
---|---|---|
scalar |
Number |
Returns:
thisArg
- Type
- fabric.Point
setFromPoint(that)
Sets x/y of this point from another point
Parameters:
Name | Type | Description |
---|---|---|
that |
fabric.Point |
setX(x)
Sets x of this point
Parameters:
Name | Type | Description |
---|---|---|
x |
Number |
setXY(x, y)
Sets x/y of this point
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | |
y |
Number |
setY(y)
Sets y of this point
Parameters:
Name | Type | Description |
---|---|---|
y |
Number |
subtract(that) → {fabric.Point}
Subtracts another point from this point and returns a new one
Parameters:
Name | Type | Description |
---|---|---|
that |
fabric.Point |
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 |
Returns:
thisArg
- Type
- fabric.Point
swap(that)
Swaps x/y of this point and another point
Parameters:
Name | Type | Description |
---|---|---|
that |
fabric.Point |
toString() → {String}
Returns string representation of this point
Returns:
- Type
- String