Some documentation clean-up.

- Prefer @return over @returns
- Place @see at the end, before @example
This commit is contained in:
Jürg Lehni 2015-06-16 14:08:34 +02:00
parent 496b8ecd0f
commit ba12eec7f5
3 changed files with 26 additions and 26 deletions

View file

@ -218,7 +218,7 @@ var Point = Base.extend(/** @lends Point# */{
* var point2 = point1.clone(); * var point2 = point1.clone();
* point2.x = 1; // doesn't change point1.x * point2.x = 1; // doesn't change point1.x
* *
* @returns {Point} the cloned point * @return {Point} the cloned point
*/ */
clone: function() { clone: function() {
return new Point(this.x, this.y); return new Point(this.x, this.y);
@ -453,7 +453,7 @@ var Point = Base.extend(/** @lends Point# */{
* *
* @param {Number} angle the rotation angle * @param {Number} angle the rotation angle
* @param {Point} center the center point of the rotation * @param {Point} center the center point of the rotation
* @returns {Point} the rotated point * @return {Point} the rotated point
*/ */
rotate: function(angle, center) { rotate: function(angle, center) {
if (angle === 0) if (angle === 0)
@ -677,7 +677,7 @@ var Point = Base.extend(/** @lends Point# */{
* Checks whether the point is inside the boundaries of the rectangle. * Checks whether the point is inside the boundaries of the rectangle.
* *
* @param {Rectangle} rect the rectangle to check against * @param {Rectangle} rect the rectangle to check against
* @returns {Boolean} {@true if the point is inside the rectangle} * @return {Boolean} {@true if the point is inside the rectangle}
*/ */
isInside: function(/* rect */) { isInside: function(/* rect */) {
return Rectangle.read(arguments).contains(this); return Rectangle.read(arguments).contains(this);
@ -688,7 +688,7 @@ var Point = Base.extend(/** @lends Point# */{
* *
* @param {Point} point the point to check against * @param {Point} point the point to check against
* @param {Number} tolerance the maximum distance allowed * @param {Number} tolerance the maximum distance allowed
* @returns {Boolean} {@true if it is within the given distance} * @return {Boolean} {@true if it is within the given distance}
*/ */
isClose: function(point, tolerance) { isClose: function(point, tolerance) {
return this.getDistance(point) < tolerance; return this.getDistance(point) < tolerance;
@ -699,7 +699,7 @@ var Point = Base.extend(/** @lends Point# */{
* another vector. * another vector.
* *
* @param {Point} point the vector to check against * @param {Point} point the vector to check against
* @returns {Boolean} {@true it is colinear} * @return {Boolean} {@true it is colinear}
*/ */
isColinear: function(point) { isColinear: function(point) {
return Math.abs(this.cross(point)) < /*#=*/Numerical.EPSILON; return Math.abs(this.cross(point)) < /*#=*/Numerical.EPSILON;
@ -710,7 +710,7 @@ var Point = Base.extend(/** @lends Point# */{
* (perpendicular) to another vector. * (perpendicular) to another vector.
* *
* @param {Point} point the vector to check against * @param {Point} point the vector to check against
* @returns {Boolean} {@true it is orthogonal} * @return {Boolean} {@true it is orthogonal}
*/ */
isOrthogonal: function(point) { isOrthogonal: function(point) {
return Math.abs(this.dot(point)) < /*#=*/Numerical.EPSILON; return Math.abs(this.dot(point)) < /*#=*/Numerical.EPSILON;
@ -719,7 +719,7 @@ var Point = Base.extend(/** @lends Point# */{
/** /**
* Checks if this point has both the x and y coordinate set to 0. * Checks if this point has both the x and y coordinate set to 0.
* *
* @returns {Boolean} {@true if both x and y are 0} * @return {Boolean} {@true if both x and y are 0}
*/ */
isZero: function() { isZero: function() {
return Numerical.isZero(this.x) && Numerical.isZero(this.y); return Numerical.isZero(this.x) && Numerical.isZero(this.y);
@ -729,7 +729,7 @@ var Point = Base.extend(/** @lends Point# */{
* Checks if this point has an undefined value for at least one of its * Checks if this point has an undefined value for at least one of its
* coordinates. * coordinates.
* *
* @returns {Boolean} {@true if either x or y are not a number} * @return {Boolean} {@true if either x or y are not a number}
*/ */
isNaN: function() { isNaN: function() {
return isNaN(this.x) || isNaN(this.y); return isNaN(this.x) || isNaN(this.y);
@ -740,7 +740,7 @@ var Point = Base.extend(/** @lends Point# */{
* Returns the dot product of the point and another point. * Returns the dot product of the point and another point.
* *
* @param {Point} point * @param {Point} point
* @returns {Number} the dot product of the two points * @return {Number} the dot product of the two points
*/ */
dot: function(/* point */) { dot: function(/* point */) {
var point = Point.read(arguments); var point = Point.read(arguments);
@ -751,7 +751,7 @@ var Point = Base.extend(/** @lends Point# */{
* Returns the cross product of the point and another point. * Returns the cross product of the point and another point.
* *
* @param {Point} point * @param {Point} point
* @returns {Number} the cross product of the two points * @return {Number} the cross product of the two points
*/ */
cross: function(/* point */) { cross: function(/* point */) {
var point = Point.read(arguments); var point = Point.read(arguments);
@ -763,7 +763,7 @@ var Point = Base.extend(/** @lends Point# */{
* Both points are interpreted as vectors. * Both points are interpreted as vectors.
* *
* @param {Point} point * @param {Point} point
* @returns {Point} the projection of the point on another point * @return {Point} the projection of the point on another point
*/ */
project: function(/* point */) { project: function(/* point */) {
var point = Point.read(arguments); var point = Point.read(arguments);
@ -855,7 +855,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 * @return {Point} the newly created point object
* *
* @example * @example
* var point1 = new Point(10, 100); * var point1 = new Point(10, 100);
@ -879,7 +879,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 * @return {Point} the newly created point object
* *
* @example * @example
* var point1 = new Point(10, 100); * var point1 = new Point(10, 100);
@ -900,7 +900,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 * @return {Point} the newly created point object
* @static * @static
* *
* @example * @example

View file

@ -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 * @return {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 * @return {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 * @return {Size} the newly created size object
* @static * @static
* *
* @example * @example

View file

@ -79,7 +79,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* *
* @param {Object} props the properties to be applied to the item * @param {Object} props the properties to be applied to the item
* @param {Point} point the point by which to transform the internal matrix * @param {Point} point the point by which to transform the internal matrix
* @returns {Boolean} {@true if the properties were successfully be applied, * @return {Boolean} {@true if the properties were successfully be applied,
* or if none were provided} * or if none were provided}
*/ */
_initialize: function(props, point) { _initialize: function(props, point) {
@ -1641,7 +1641,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
// TEST: // TEST:
/** /**
* @param {Rectangle} rect the rectangle to check against * @param {Rectangle} rect the rectangle to check against
* @returns {Boolean} * @return {Boolean}
*/ */
isInside: function(/* rect */) { isInside: function(/* rect */) {
return Rectangle.read(arguments).contains(this.getBounds()); return Rectangle.read(arguments).contains(this.getBounds());
@ -1664,7 +1664,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
// TEST: // TEST:
/** /**
* @param {Item} item the item to check against * @param {Item} item the item to check against
* @returns {Boolean} * @return {Boolean}
*/ */
intersects: function(item, _matrix) { intersects: function(item, _matrix) {
if (!(item instanceof Item)) if (!(item instanceof Item))
@ -1831,9 +1831,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* @name Item#matches * @name Item#matches
* @function * @function
* *
* @see #getItems(match)
* @param {Object} match the criteria to match against. * @param {Object} match the criteria to match against.
* @return {@true if the item matches all the criteria} * @return {@true if the item matches all the criteria}
* @see #getItems(match)
*/ */
/** /**
* Checks whether the item matches the given criteria. Extended matching is * Checks whether the item matches the given criteria. Extended matching is
@ -1849,11 +1849,11 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* @name Item#matches * @name Item#matches
* @function * @function
* *
* @see #getItems(match)
* @param {String} name the name of the state to match against. * @param {String} name the name of the state to match against.
* @param {Object} compare the value, function or regular expression to * @param {Object} compare the value, function or regular expression to
* compare against. * compare against.
* @return {@true if the item matches the state} * @return {@true if the item matches the state}
* @see #getItems(match)
*/ */
matches: function(name, compare) { matches: function(name, compare) {
// matchObject() is used to match against objects in a nested manner. // matchObject() is used to match against objects in a nested manner.
@ -1931,9 +1931,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* @option match.overlapping {Rectangle} the rectangle with which the items * @option match.overlapping {Rectangle} the rectangle with which the items
* need to at least partly overlap. * need to at least partly overlap.
* *
* @see #matches(match)
* @param {Object} match the criteria to match against. * @param {Object} match the criteria to match against.
* @return {Item[]} the list of matching descendant items. * @return {Item[]} the list of matching descendant items.
* @see #matches(match)
*/ */
getItems: function(match) { getItems: function(match) {
return Item._getItems(this._children, match, this._matrix); return Item._getItems(this._children, match, this._matrix);
@ -1950,9 +1950,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* See {@link Project#getItems(match)} for a selection of illustrated * See {@link Project#getItems(match)} for a selection of illustrated
* examples. * examples.
* *
* @see #getItems(match)
* @param {Object} match the criteria to match against. * @param {Object} match the criteria to match against.
* @return {Item} the first descendant item matching the given criteria. * @return {Item} the first descendant item matching the given criteria.
* @see #getItems(match)
*/ */
getItem: function(match) { getItem: function(match) {
return Item._getItems(this._children, match, this._matrix, null, true) return Item._getItems(this._children, match, this._matrix, null, true)
@ -2439,8 +2439,6 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
} }
}, },
// TODO: Item#isEditable is currently ignored in the documentation, as
// locking an item currently has no effect
/** /**
* {@grouptitle Tests} * {@grouptitle Tests}
* Specifies whether the item has any content or not. The meaning of what * Specifies whether the item has any content or not. The meaning of what
@ -2461,6 +2459,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* locked or hidden} * locked or hidden}
* @ignore * @ignore
*/ */
// TODO: Item#isEditable is currently ignored in the documentation, as
// locking an item currently has no effect
isEditable: function() { isEditable: function() {
var item = this; var item = this;
while (item) { while (item) {