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
将该点除以一个值并返回一个新值
TODO:在scalarDivide中重命名
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
将这个点除以一个值
TODO:在scalarDivideEquals中重命名
Parameters:
Name | Type | Description |
---|---|---|
scalar |
Number |
Returns:
thisArg
- Type
- fabric.Point
eq(that) → {Boolean}
Returns true if this point is equal to another one
如果此点等于另一个点,则返回true
Parameters:
Name | Type | Description |
---|---|---|
that |
fabric.Point |
Returns:
- Type
- Boolean
gt(that) → {Boolean}
Returns true if this point is greater another one
如果此点大于另一个点,则返回true
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
如果此点大于或等于另一个点,则返回true
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,插值位置,介于0和1之间,默认为0.5 |
Returns:
- Type
- fabric.Point
lt(that) → {Boolean}
Returns true if this point is less than another one
如果此点小于另一个点,则返回true
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
如果此点小于或等于另一个点,则返回true
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
将此点乘以一个值并返回一个新值
TODO:在scalarMultiply中重命名
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
将这个点乘以一个值
TODO:重命名scalarmultiplequals在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
从另一点求出该点的x/y
Parameters:
Name | Type | Description |
---|---|---|
that |
fabric.Point |
setX(x)
Sets x of this point
集合这个点的x
Parameters:
Name | Type | Description |
---|---|---|
x |
Number |
setXY(x, y)
Sets x/y of this point
求这一点的x/y
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | |
y |
Number |
setY(y)
Sets y of this point
集合这个点的y
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
交换这一点和另一点的x/y
Parameters:
Name | Type | Description |
---|---|---|
that |
fabric.Point |
toString() → {String}
Returns string representation of this point
返回该点的字符串表示形式
Returns:
- Type
- String