mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Fix documentation irregularities.
This commit is contained in:
parent
cd74aaf5a3
commit
19c7788617
16 changed files with 133 additions and 130 deletions
|
@ -43,19 +43,19 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
/**
|
/**
|
||||||
* Creates a 2D affine transform.
|
* Creates a 2D affine transform.
|
||||||
*
|
*
|
||||||
* @param {Number} a The scaleX coordinate of the transform
|
* @param {Number} a the scaleX coordinate of the transform
|
||||||
* @param {Number} c The shearY coordinate of the transform
|
* @param {Number} c the shearY coordinate of the transform
|
||||||
* @param {Number} b The shearX coordinate of the transform
|
* @param {Number} b the shearX coordinate of the transform
|
||||||
* @param {Number} d The scaleY coordinate of the transform
|
* @param {Number} d the scaleY coordinate of the transform
|
||||||
* @param {Number} tx The translateX coordinate of the transform
|
* @param {Number} tx the translateX coordinate of the transform
|
||||||
* @param {Number} ty The translateY coordinate of the transform
|
* @param {Number} ty the translateY coordinate of the transform
|
||||||
*/
|
*/
|
||||||
initialize: function Matrix(arg) {
|
initialize: function Matrix(arg) {
|
||||||
var count = arguments.length,
|
var count = arguments.length,
|
||||||
ok = true;
|
ok = true;
|
||||||
if (count == 6) {
|
if (count === 6) {
|
||||||
this.set.apply(this, arguments);
|
this.set.apply(this, arguments);
|
||||||
} else if (count == 1) {
|
} else if (count === 1) {
|
||||||
if (arg instanceof Matrix) {
|
if (arg instanceof Matrix) {
|
||||||
this.set(arg._a, arg._c, arg._b, arg._d, arg._tx, arg._ty);
|
this.set(arg._a, arg._c, arg._b, arg._d, arg._tx, arg._ty);
|
||||||
} else if (Array.isArray(arg)) {
|
} else if (Array.isArray(arg)) {
|
||||||
|
@ -63,7 +63,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
} else {
|
} else {
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
} else if (count == 0) {
|
} else if (count === 0) {
|
||||||
this.reset();
|
this.reset();
|
||||||
} else {
|
} else {
|
||||||
ok = false;
|
ok = false;
|
||||||
|
@ -75,13 +75,13 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
/**
|
/**
|
||||||
* Sets this transform to the matrix specified by the 6 values.
|
* Sets this transform to the matrix specified by the 6 values.
|
||||||
*
|
*
|
||||||
* @param {Number} a The scaleX coordinate of the transform
|
* @param {Number} a the scaleX coordinate of the transform
|
||||||
* @param {Number} c The shearY coordinate of the transform
|
* @param {Number} c the shearY coordinate of the transform
|
||||||
* @param {Number} b The shearX coordinate of the transform
|
* @param {Number} b the shearX coordinate of the transform
|
||||||
* @param {Number} d The scaleY coordinate of the transform
|
* @param {Number} d the scaleY coordinate of the transform
|
||||||
* @param {Number} tx The translateX coordinate of the transform
|
* @param {Number} tx the translateX coordinate of the transform
|
||||||
* @param {Number} ty The translateY coordinate of the transform
|
* @param {Number} ty the translateY coordinate of the transform
|
||||||
* @return {Matrix} This affine transform
|
* @return {Matrix} this affine transform
|
||||||
*/
|
*/
|
||||||
set: function(a, c, b, d, tx, ty) {
|
set: function(a, c, b, d, tx, ty) {
|
||||||
this._a = a;
|
this._a = a;
|
||||||
|
@ -98,7 +98,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Matrix} A copy of this transform.
|
* @return {Matrix} a copy of this transform
|
||||||
*/
|
*/
|
||||||
clone: function() {
|
clone: function() {
|
||||||
return new Matrix(this._a, this._c, this._b, this._d,
|
return new Matrix(this._a, this._c, this._b, this._d,
|
||||||
|
@ -119,7 +119,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {String} A string representation of this transform.
|
* @return {String} a string representation of this transform
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
var f = Formatter.instance;
|
var f = Formatter.instance;
|
||||||
|
@ -144,19 +144,19 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
*
|
*
|
||||||
* @name Matrix#scale
|
* @name Matrix#scale
|
||||||
* @function
|
* @function
|
||||||
* @param {Number} scale The scaling factor
|
* @param {Number} scale the scaling factor
|
||||||
* @param {Point} [center] The center for the scaling transformation
|
* @param {Point} [center] the center for the scaling transformation
|
||||||
* @return {Matrix} This affine transform
|
* @return {Matrix} this affine transform
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Concatenates this transform with a scaling transformation.
|
* Concatenates this transform with a scaling transformation.
|
||||||
*
|
*
|
||||||
* @name Matrix#scale
|
* @name Matrix#scale
|
||||||
* @function
|
* @function
|
||||||
* @param {Number} hor The horizontal scaling factor
|
* @param {Number} hor the horizontal scaling factor
|
||||||
* @param {Number} ver The vertical scaling factor
|
* @param {Number} ver the vertical scaling factor
|
||||||
* @param {Point} [center] The center for the scaling transformation
|
* @param {Point} [center] the center for the scaling transformation
|
||||||
* @return {Matrix} This affine transform
|
* @return {Matrix} this affine transform
|
||||||
*/
|
*/
|
||||||
scale: function(/* scale, center */) {
|
scale: function(/* scale, center */) {
|
||||||
// Do not modify scale, center, since that would arguments of which
|
// Do not modify scale, center, since that would arguments of which
|
||||||
|
@ -179,17 +179,17 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
*
|
*
|
||||||
* @name Matrix#translate
|
* @name Matrix#translate
|
||||||
* @function
|
* @function
|
||||||
* @param {Point} point The vector to translate by
|
* @param {Point} point the vector to translate by
|
||||||
* @return {Matrix} This affine transform
|
* @return {Matrix} this affine transform
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Concatenates this transform with a translate transformation.
|
* Concatenates this transform with a translate transformation.
|
||||||
*
|
*
|
||||||
* @name Matrix#translate
|
* @name Matrix#translate
|
||||||
* @function
|
* @function
|
||||||
* @param {Number} dx The distance to translate in the x direction
|
* @param {Number} dx the distance to translate in the x direction
|
||||||
* @param {Number} dy The distance to translate in the y direction
|
* @param {Number} dy the distance to translate in the y direction
|
||||||
* @return {Matrix} This affine transform
|
* @return {Matrix} this affine transform
|
||||||
*/
|
*/
|
||||||
translate: function(point) {
|
translate: function(point) {
|
||||||
point = Point.read(arguments);
|
point = Point.read(arguments);
|
||||||
|
@ -206,9 +206,9 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
*
|
*
|
||||||
* @name Matrix#rotate
|
* @name Matrix#rotate
|
||||||
* @function
|
* @function
|
||||||
* @param {Number} angle The angle of rotation measured in degrees
|
* @param {Number} angle the angle of rotation measured in degrees
|
||||||
* @param {Point} center The anchor point to rotate around
|
* @param {Point} center the anchor point to rotate around
|
||||||
* @return {Matrix} This affine transform
|
* @return {Matrix} this affine transform
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Concatenates this transform with a rotation transformation around an
|
* Concatenates this transform with a rotation transformation around an
|
||||||
|
@ -216,10 +216,10 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
*
|
*
|
||||||
* @name Matrix#rotate
|
* @name Matrix#rotate
|
||||||
* @function
|
* @function
|
||||||
* @param {Number} angle The angle of rotation measured in degrees
|
* @param {Number} angle the angle of rotation measured in degrees
|
||||||
* @param {Number} x The x coordinate of the anchor point
|
* @param {Number} x the x coordinate of the anchor point
|
||||||
* @param {Number} y The y coordinate of the anchor point
|
* @param {Number} y the y coordinate of the anchor point
|
||||||
* @return {Matrix} This affine transform
|
* @return {Matrix} this affine transform
|
||||||
*/
|
*/
|
||||||
rotate: function(angle, center) {
|
rotate: function(angle, center) {
|
||||||
center = Point.read(arguments, 1);
|
center = Point.read(arguments, 1);
|
||||||
|
@ -249,19 +249,19 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
*
|
*
|
||||||
* @name Matrix#shear
|
* @name Matrix#shear
|
||||||
* @function
|
* @function
|
||||||
* @param {Point} point The shear factor in x and y direction
|
* @param {Point} point the shear factor in x and y direction
|
||||||
* @param {Point} [center] The center for the shear transformation
|
* @param {Point} [center] the center for the shear transformation
|
||||||
* @return {Matrix} This affine transform
|
* @return {Matrix} this affine transform
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Concatenates this transform with a shear transformation.
|
* Concatenates this transform with a shear transformation.
|
||||||
*
|
*
|
||||||
* @name Matrix#shear
|
* @name Matrix#shear
|
||||||
* @function
|
* @function
|
||||||
* @param {Number} hor The horizontal shear factor
|
* @param {Number} hor the horizontal shear factor
|
||||||
* @param {Number} ver The vertical shear factor
|
* @param {Number} ver the vertical shear factor
|
||||||
* @param {Point} [center] The center for the shear transformation
|
* @param {Point} [center] the center for the shear transformation
|
||||||
* @return {Matrix} This affine transform
|
* @return {Matrix} this affine transform
|
||||||
*/
|
*/
|
||||||
shear: function(/* point, center */) {
|
shear: function(/* point, center */) {
|
||||||
// Do not modify point, center, since that would arguments of which
|
// Do not modify point, center, since that would arguments of which
|
||||||
|
@ -281,39 +281,11 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {Boolean} Whether this transform is the identity transform
|
|
||||||
*/
|
|
||||||
isIdentity: function() {
|
|
||||||
return this._a == 1 && this._c == 0 && this._b == 0 && this._d == 1
|
|
||||||
&& this._tx == 0 && this._ty == 0;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the transform is invertible. A transform is not
|
|
||||||
* invertible if the determinant is 0 or any value is non-finite or NaN.
|
|
||||||
*
|
|
||||||
* @return {Boolean} Whether the transform is invertible
|
|
||||||
*/
|
|
||||||
isInvertible: function() {
|
|
||||||
return !!this._getDeterminant();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether the matrix is singular or not. Singular matrices cannot be
|
|
||||||
* inverted.
|
|
||||||
*
|
|
||||||
* @return {Boolean} Whether the matrix is singular
|
|
||||||
*/
|
|
||||||
isSingular: function() {
|
|
||||||
return !this._getDeterminant();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concatenates an affine transform to this transform.
|
* Concatenates an affine transform to this transform.
|
||||||
*
|
*
|
||||||
* @param {Matrix} mx The transform to concatenate
|
* @param {Matrix} mx the transform to concatenate
|
||||||
* @return {Matrix} This affine transform
|
* @return {Matrix} this affine transform
|
||||||
*/
|
*/
|
||||||
concatenate: function(mx) {
|
concatenate: function(mx) {
|
||||||
var a = this._a,
|
var a = this._a,
|
||||||
|
@ -332,8 +304,8 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
/**
|
/**
|
||||||
* Pre-concatenates an affine transform to this transform.
|
* Pre-concatenates an affine transform to this transform.
|
||||||
*
|
*
|
||||||
* @param {Matrix} mx The transform to preconcatenate
|
* @param {Matrix} mx the transform to preconcatenate
|
||||||
* @return {Matrix} This affine transform
|
* @return {Matrix} this affine transform
|
||||||
*/
|
*/
|
||||||
preConcatenate: function(mx) {
|
preConcatenate: function(mx) {
|
||||||
var a = this._a,
|
var a = this._a,
|
||||||
|
@ -351,13 +323,41 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {Boolean} whether this transform is the identity transform
|
||||||
|
*/
|
||||||
|
isIdentity: function() {
|
||||||
|
return this._a == 1 && this._c == 0 && this._b == 0 && this._d == 1
|
||||||
|
&& this._tx == 0 && this._ty == 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the transform is invertible. A transform is not
|
||||||
|
* invertible if the determinant is 0 or any value is non-finite or NaN.
|
||||||
|
*
|
||||||
|
* @return {Boolean} whether the transform is invertible
|
||||||
|
*/
|
||||||
|
isInvertible: function() {
|
||||||
|
return !!this._getDeterminant();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the matrix is singular or not. Singular matrices cannot be
|
||||||
|
* inverted.
|
||||||
|
*
|
||||||
|
* @return {Boolean} whether the matrix is singular
|
||||||
|
*/
|
||||||
|
isSingular: function() {
|
||||||
|
return !this._getDeterminant();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transforms a point and returns the result.
|
* Transforms a point and returns the result.
|
||||||
*
|
*
|
||||||
* @name Matrix#transform
|
* @name Matrix#transform
|
||||||
* @function
|
* @function
|
||||||
* @param {Point} point The point to be transformed
|
* @param {Point} point the point to be transformed
|
||||||
* @return {Point} The transformed point
|
* @return {Point} the transformed point
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Transforms an array of coordinates by this matrix and stores the results
|
* Transforms an array of coordinates by this matrix and stores the results
|
||||||
|
@ -365,15 +365,15 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
*
|
*
|
||||||
* @name Matrix#transform
|
* @name Matrix#transform
|
||||||
* @function
|
* @function
|
||||||
* @param {Number[]} src The array containing the source points
|
* @param {Number[]} src the array containing the source points
|
||||||
* as x, y value pairs
|
* as x, y value pairs
|
||||||
* @param {Number} srcOff The offset to the first point to be transformed
|
* @param {Number} srcOff the offset to the first point to be transformed
|
||||||
* @param {Number[]} dst The array into which to store the transformed
|
* @param {Number[]} dst the array into which to store the transformed
|
||||||
* point pairs
|
* point pairs
|
||||||
* @param {Number} dstOff The offset of the location of the first
|
* @param {Number} dstOff the offset of the location of the first
|
||||||
* transformed point in the destination array
|
* transformed point in the destination array
|
||||||
* @param {Number} numPts The number of points to tranform
|
* @param {Number} numPts the number of points to tranform
|
||||||
* @return {Number[]} The dst array, containing the transformed coordinates.
|
* @return {Number[]} the dst array, containing the transformed coordinates.
|
||||||
*/
|
*/
|
||||||
transform: function(/* point | */ src, srcOff, dst, dstOff, numPts) {
|
transform: function(/* point | */ src, srcOff, dst, dstOff, numPts) {
|
||||||
return arguments.length < 5
|
return arguments.length < 5
|
||||||
|
@ -445,7 +445,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
/**
|
/**
|
||||||
* Inverse transforms a point and returns the result.
|
* Inverse transforms a point and returns the result.
|
||||||
*
|
*
|
||||||
* @param {Point} point The point to be transformed
|
* @param {Point} point the point to be transformed
|
||||||
*/
|
*/
|
||||||
inverseTransform: function(/* point */) {
|
inverseTransform: function(/* point */) {
|
||||||
return this._inverseTransform(Point.read(arguments));
|
return this._inverseTransform(Point.read(arguments));
|
||||||
|
@ -541,14 +541,14 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Number} The shear factor in the x-direction ({@code b}).
|
* The shear factor in the x-direction ({@code b}).
|
||||||
*
|
*
|
||||||
* @name Matrix#shearX
|
* @name Matrix#shearX
|
||||||
* @type Number
|
* @type Number
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Number} The shear factor in the y-direction ({@code c}).
|
* The shear factor in the y-direction ({@code c}).
|
||||||
*
|
*
|
||||||
* @name Matrix#shearY
|
* @name Matrix#shearY
|
||||||
* @type Number
|
* @type Number
|
||||||
|
@ -617,7 +617,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
* (in which case {@link #isSingular()} returns true), {@code null } is
|
* (in which case {@link #isSingular()} returns true), {@code null } is
|
||||||
* returned.
|
* returned.
|
||||||
*
|
*
|
||||||
* @return {Matrix} The inverted matrix, or {@code null }, if the matrix is
|
* @return {Matrix} the inverted matrix, or {@code null }, if the matrix is
|
||||||
* singular
|
* singular
|
||||||
*/
|
*/
|
||||||
inverted: function() {
|
inverted: function() {
|
||||||
|
|
|
@ -223,7 +223,7 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {String} A string representation of the point.
|
* @return {String} a string representation of the point
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
var f = Formatter.instance;
|
var f = Formatter.instance;
|
||||||
|
@ -434,7 +434,7 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
* is not modified!
|
* is not modified!
|
||||||
*
|
*
|
||||||
* @param {Matrix} matrix
|
* @param {Matrix} matrix
|
||||||
* @return {Point} The transformed point
|
* @return {Point} the transformed point
|
||||||
*/
|
*/
|
||||||
transform: function(matrix) {
|
transform: function(matrix) {
|
||||||
return matrix ? matrix._transformPoint(this) : this;
|
return matrix ? matrix._transformPoint(this) : this;
|
||||||
|
@ -505,8 +505,8 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
* The object itself is not modified!
|
* The object itself is not modified!
|
||||||
*
|
*
|
||||||
* @param {Number} [length=1] The length of the normalized vector
|
* @param {Number} [length=1] The length of the normalized vector
|
||||||
* @return {Point} The normalized vector of the vector that is represented
|
* @return {Point} the normalized vector of the vector that is represented
|
||||||
* by this point's coordinates.
|
* by this point's coordinates
|
||||||
*/
|
*/
|
||||||
normalize: function(length) {
|
normalize: function(length) {
|
||||||
if (length === undefined)
|
if (length === undefined)
|
||||||
|
@ -853,7 +853,7 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
* @static
|
* @static
|
||||||
* @param {Point} point1
|
* @param {Point} point1
|
||||||
* @param {Point} point2
|
* @param {Point} point2
|
||||||
* @returns {Point} The newly created point object
|
* @returns {Point} the newly created point object
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* var point1 = new Point(10, 100);
|
* var point1 = new Point(10, 100);
|
||||||
|
@ -877,7 +877,7 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
* @static
|
* @static
|
||||||
* @param {Point} point1
|
* @param {Point} point1
|
||||||
* @param {Point} point2
|
* @param {Point} point2
|
||||||
* @returns {Point} The newly created point object
|
* @returns {Point} the newly created point object
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* var point1 = new Point(10, 100);
|
* var point1 = new Point(10, 100);
|
||||||
|
@ -898,7 +898,7 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
* Returns a point object with random {@link #x} and {@link #y} values
|
* Returns a point object with random {@link #x} and {@link #y} values
|
||||||
* between {@code 0} and {@code 1}.
|
* between {@code 0} and {@code 1}.
|
||||||
*
|
*
|
||||||
* @returns {Point} The newly created point object
|
* @returns {Point} the newly created point object
|
||||||
* @static
|
* @static
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
|
|
|
@ -210,7 +210,7 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {String} A string representation of this rectangle.
|
* @return {String} a string representation of this rectangle
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
var f = Formatter.instance;
|
var f = Formatter.instance;
|
||||||
|
@ -647,8 +647,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
*
|
*
|
||||||
* @param {Rectangle} rect The rectangle to be intersected with this
|
* @param {Rectangle} rect The rectangle to be intersected with this
|
||||||
* rectangle
|
* rectangle
|
||||||
* @return {Rectangle} The largest rectangle contained in both the specified
|
* @return {Rectangle} the largest rectangle contained in both the specified
|
||||||
* rectangle and in this rectangle.
|
* rectangle and in this rectangle
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* // Intersecting two rectangles and visualizing the result using rectangle
|
* // Intersecting two rectangles and visualizing the result using rectangle
|
||||||
|
|
|
@ -172,7 +172,7 @@ var Size = Base.extend(/** @lends Size# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {String} A string representation of the size.
|
* @return {String} a string representation of the size
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
var f = Formatter.instance;
|
var f = Formatter.instance;
|
||||||
|
@ -459,7 +459,7 @@ var Size = Base.extend(/** @lends Size# */{
|
||||||
* @static
|
* @static
|
||||||
* @param {Size} size1
|
* @param {Size} size1
|
||||||
* @param {Size} size2
|
* @param {Size} size2
|
||||||
* @returns {Size} The newly created size object
|
* @returns {Size} the newly created size object
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* var size1 = new Size(10, 100);
|
* var size1 = new Size(10, 100);
|
||||||
|
@ -480,7 +480,7 @@ var Size = Base.extend(/** @lends Size# */{
|
||||||
* @static
|
* @static
|
||||||
* @param {Size} size1
|
* @param {Size} size1
|
||||||
* @param {Size} size2
|
* @param {Size} size2
|
||||||
* @returns {Size} The newly created size object
|
* @returns {Size} the newly created size object
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* var size1 = new Size(10, 100);
|
* var size1 = new Size(10, 100);
|
||||||
|
@ -498,7 +498,7 @@ var Size = Base.extend(/** @lends Size# */{
|
||||||
* Returns a size object with random {@link #width} and {@link #height}
|
* Returns a size object with random {@link #width} and {@link #height}
|
||||||
* values between {@code 0} and {@code 1}.
|
* values between {@code 0} and {@code 1}.
|
||||||
*
|
*
|
||||||
* @returns {Size} The newly created size object
|
* @returns {Size} the newly created size object
|
||||||
* @static
|
* @static
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
|
|
|
@ -108,8 +108,8 @@ paper.PaperScope.prototype.PaperScript = (function(root) {
|
||||||
*
|
*
|
||||||
* @name PaperScript.compile
|
* @name PaperScript.compile
|
||||||
* @function
|
* @function
|
||||||
* @param {String} code The PaperScript code.
|
* @param {String} code The PaperScript code
|
||||||
* @return {String} The compiled PaperScript as JavaScript code.
|
* @return {String} the compiled PaperScript as JavaScript code
|
||||||
*/
|
*/
|
||||||
function compile(code) {
|
function compile(code) {
|
||||||
// Use Acorn or Esprima to translate the code into an AST structure
|
// Use Acorn or Esprima to translate the code into an AST structure
|
||||||
|
@ -238,9 +238,9 @@ paper.PaperScope.prototype.PaperScript = (function(root) {
|
||||||
*
|
*
|
||||||
* @name PaperScript.evaluate
|
* @name PaperScript.evaluate
|
||||||
* @function
|
* @function
|
||||||
* @param {String} code The PaperScript code.
|
* @param {String} code The PaperScript code
|
||||||
* @param {PaperScript} scope The scope in which the code is executed.
|
* @param {PaperScript} scope The scope in which the code is executed
|
||||||
* @return {Object} The result of the code evaluation.
|
* @return {Object} the result of the code evaluation
|
||||||
*/
|
*/
|
||||||
function evaluate(code, scope) {
|
function evaluate(code, scope) {
|
||||||
// Set currently active scope.
|
// Set currently active scope.
|
||||||
|
|
|
@ -749,8 +749,8 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The item's transformation matrix, defining position and dimensions in the
|
* The item's transformation matrix, defining position and dimensions in
|
||||||
* document.
|
* relation to its parent item in which it is contained.
|
||||||
*
|
*
|
||||||
* @type Matrix
|
* @type Matrix
|
||||||
* @bean
|
* @bean
|
||||||
|
@ -1400,9 +1400,9 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
||||||
* @param {Point} point The point where the hit test should be performed
|
* @param {Point} point The point where the hit test should be performed
|
||||||
* @param {Object} [options={ fill: true, stroke: true, segments: true,
|
* @param {Object} [options={ fill: true, stroke: true, segments: true,
|
||||||
* tolerance: 2 }]
|
* tolerance: 2 }]
|
||||||
* @return {HitResult} A hit result object that contains more
|
* @return {HitResult} a hit result object that contains more
|
||||||
* information about what exactly was hit or {@code null} if nothing was
|
* information about what exactly was hit or {@code null} if nothing was
|
||||||
* hit.
|
* hit
|
||||||
*/
|
*/
|
||||||
hitTest: function(point, options) {
|
hitTest: function(point, options) {
|
||||||
point = Point.read(arguments);
|
point = Point.read(arguments);
|
||||||
|
|
|
@ -405,7 +405,7 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
* or the curve time parameter if {@code isParameter} is {@code true}
|
* or the curve time parameter if {@code isParameter} is {@code true}
|
||||||
* @param {Boolean} [isParameter=false] pass {@code true} if {@code offset}
|
* @param {Boolean} [isParameter=false] pass {@code true} if {@code offset}
|
||||||
* is a curve time parameter.
|
* is a curve time parameter.
|
||||||
* @return {Path} The newly created path after splitting, if any
|
* @return {Path} the newly created path after splitting, if any
|
||||||
* @see Path#split(index, parameter)
|
* @see Path#split(index, parameter)
|
||||||
*/
|
*/
|
||||||
// TODO: Rename to splitAt()?
|
// TODO: Rename to splitAt()?
|
||||||
|
@ -426,7 +426,7 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {String} A string representation of the curve.
|
* @return {String} a string representation of the curve
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
var parts = [ 'point1: ' + this._segment1._point ];
|
var parts = [ 'point1: ' + this._segment1._point ];
|
||||||
|
|
|
@ -247,7 +247,7 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {String} A string representation of the curve location.
|
* @return {String} a string representation of the curve location
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
var parts = [],
|
var parts = [],
|
||||||
|
|
|
@ -918,7 +918,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
* @function
|
* @function
|
||||||
* @param {Number} offset the offset at which to split the path
|
* @param {Number} offset the offset at which to split the path
|
||||||
* as a number between 0 and {@link Path#length}
|
* as a number between 0 and {@link Path#length}
|
||||||
* @return {Path} The newly created path after splitting, if any
|
* @return {Path} the newly created path after splitting, if any
|
||||||
*
|
*
|
||||||
* @example {@paperscript} // Splitting an open path
|
* @example {@paperscript} // Splitting an open path
|
||||||
* var path = new Path();
|
* var path = new Path();
|
||||||
|
@ -961,7 +961,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
* @function
|
* @function
|
||||||
* @param {CurveLocation} location the curve location at which to split
|
* @param {CurveLocation} location the curve location at which to split
|
||||||
* the path
|
* the path
|
||||||
* @return {Path} The newly created path after splitting, if any
|
* @return {Path} the newly created path after splitting, if any
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* var path = new Path.Circle({
|
* var path = new Path.Circle({
|
||||||
|
@ -1018,7 +1018,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
* @param {Number} index the index of the curve in the {@link Path#curves}
|
* @param {Number} index the index of the curve in the {@link Path#curves}
|
||||||
* array at which to split
|
* array at which to split
|
||||||
* @param {Number} parameter the parameter at which the curve will be split
|
* @param {Number} parameter the parameter at which the curve will be split
|
||||||
* @return {Path} The newly created path after splitting, if any
|
* @return {Path} the newly created path after splitting, if any
|
||||||
*/
|
*/
|
||||||
split: function(index, parameter) {
|
split: function(index, parameter) {
|
||||||
if (parameter === null)
|
if (parameter === null)
|
||||||
|
@ -1540,8 +1540,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
* Returns the nearest location on the path to the specified point.
|
* Returns the nearest location on the path to the specified point.
|
||||||
*
|
*
|
||||||
* @function
|
* @function
|
||||||
* @param point {Point} The point for which we search the nearest location
|
* @param point {Point} the point for which we search the nearest location
|
||||||
* @return {CurveLocation} The location on the path that's the closest to
|
* @return {CurveLocation} the location on the path that's the closest to
|
||||||
* the specified point
|
* the specified point
|
||||||
*/
|
*/
|
||||||
getNearestLocation: function(point) {
|
getNearestLocation: function(point) {
|
||||||
|
@ -1563,8 +1563,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
* Returns the nearest point on the path to the specified point.
|
* Returns the nearest point on the path to the specified point.
|
||||||
*
|
*
|
||||||
* @function
|
* @function
|
||||||
* @param point {Point} The point for which we search the nearest point
|
* @param point {Point} the point for which we search the nearest point
|
||||||
* @return {Point} The point on the path that's the closest to the specified
|
* @return {Point} the point on the path that's the closest to the specified
|
||||||
* point
|
* point
|
||||||
*
|
*
|
||||||
* @example {@paperscript height=200}
|
* @example {@paperscript height=200}
|
||||||
|
|
|
@ -437,7 +437,7 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {String} A string representation of the segment.
|
* @return {String} a string representation of the segment
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
var parts = [ 'point: ' + this._point ];
|
var parts = [ 'point: ' + this._point ];
|
||||||
|
|
|
@ -247,9 +247,9 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
* @param {Point} point The point where the hit test should be performed
|
* @param {Point} point The point where the hit test should be performed
|
||||||
* @param {Object} [options={ fill: true, stroke: true, segments: true,
|
* @param {Object} [options={ fill: true, stroke: true, segments: true,
|
||||||
* tolerance: true }]
|
* tolerance: true }]
|
||||||
* @return {HitResult} A hit result object that contains more
|
* @return {HitResult} a hit result object that contains more
|
||||||
* information about what exactly was hit or {@code null} if nothing was
|
* information about what exactly was hit or {@code null} if nothing was
|
||||||
* hit.
|
* hit
|
||||||
*/
|
*/
|
||||||
hitTest: function(point, options) {
|
hitTest: function(point, options) {
|
||||||
// We don't need to do this here, but it speeds up things since we won't
|
// We don't need to do this here, but it speeds up things since we won't
|
||||||
|
@ -334,6 +334,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
draw: function(ctx, matrix) {
|
draw: function(ctx, matrix) {
|
||||||
|
// Increase the drawCount before the draw-loop. After that, items that
|
||||||
|
// are visible will have their drawCount set to the new value.
|
||||||
this._drawCount++;
|
this._drawCount++;
|
||||||
ctx.save();
|
ctx.save();
|
||||||
matrix.applyToContext(ctx);
|
matrix.applyToContext(ctx);
|
||||||
|
|
|
@ -748,7 +748,7 @@ var Color = Base.extend(new function() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@grouptitle String Representations}
|
* {@grouptitle String Representations}
|
||||||
* @return {String} A string representation of the color.
|
* @return {String} a string representation of the color
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
var properties = this._properties,
|
var properties = this._properties,
|
||||||
|
@ -767,7 +767,7 @@ var Color = Base.extend(new function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {String} A css string representation of the color.
|
* @return {String} a css string representation of the color
|
||||||
*/
|
*/
|
||||||
toCSS: function(noAlpha) {
|
toCSS: function(noAlpha) {
|
||||||
var components = this._convert('rgb'),
|
var components = this._convert('rgb'),
|
||||||
|
|
|
@ -199,7 +199,7 @@ var ToolEvent = Event.extend(/** @lends ToolEvent# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {String} A string representation of the tool event.
|
* @return {String} a string representation of the tool event
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
return '{ type: ' + this.type
|
return '{ type: ' + this.type
|
||||||
|
|
|
@ -52,7 +52,7 @@ var KeyEvent = Event.extend(/** @lends KeyEvent# */{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {String} A string representation of the key event.
|
* @return {String} a string representation of the key event
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
return "{ type: '" + this.type
|
return "{ type: '" + this.type
|
||||||
|
|
|
@ -62,7 +62,7 @@ var MouseEvent = Event.extend(/** @lends MouseEvent# */{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {String} A string representation of the mouse event.
|
* @return {String} a string representation of the mouse event
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
return "{ type: '" + this.type
|
return "{ type: '" + this.type
|
||||||
|
|
|
@ -359,7 +359,7 @@ var View = Base.extend(Callback, /** @lends View# */{
|
||||||
* Checks whether the view is currently visible within the current browser
|
* Checks whether the view is currently visible within the current browser
|
||||||
* viewport.
|
* viewport.
|
||||||
*
|
*
|
||||||
* @return {Boolean} Whether the view is visible.
|
* @return {Boolean} whether the view is visible.
|
||||||
*/
|
*/
|
||||||
isVisible: function() {
|
isVisible: function() {
|
||||||
return DomElement.isInView(this._element);
|
return DomElement.isInView(this._element);
|
||||||
|
@ -392,6 +392,7 @@ var View = Base.extend(Callback, /** @lends View# */{
|
||||||
// TODO: getMousePoint
|
// TODO: getMousePoint
|
||||||
// TODO: projectToView(rect)
|
// TODO: projectToView(rect)
|
||||||
|
|
||||||
|
// DOCS: projectToView(point), viewToProject(point)
|
||||||
projectToView: function(/* point */) {
|
projectToView: function(/* point */) {
|
||||||
return this._matrix._transformPoint(Point.read(arguments));
|
return this._matrix._transformPoint(Point.read(arguments));
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue