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();
* point2.x = 1; // doesn't change point1.x
*
* @returns {Point} the cloned point
* @return {Point} the cloned point
*/
clone: function() {
return new Point(this.x, this.y);
@ -453,7 +453,7 @@ var Point = Base.extend(/** @lends Point# */{
*
* @param {Number} angle the rotation angle
* @param {Point} center the center point of the rotation
* @returns {Point} the rotated point
* @return {Point} the rotated point
*/
rotate: function(angle, center) {
if (angle === 0)
@ -677,7 +677,7 @@ var Point = Base.extend(/** @lends Point# */{
* Checks whether the point is inside the boundaries of the rectangle.
*
* @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 */) {
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 {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) {
return this.getDistance(point) < tolerance;
@ -699,7 +699,7 @@ var Point = Base.extend(/** @lends Point# */{
* another vector.
*
* @param {Point} point the vector to check against
* @returns {Boolean} {@true it is colinear}
* @return {Boolean} {@true it is colinear}
*/
isColinear: function(point) {
return Math.abs(this.cross(point)) < /*#=*/Numerical.EPSILON;
@ -710,7 +710,7 @@ var Point = Base.extend(/** @lends Point# */{
* (perpendicular) to another vector.
*
* @param {Point} point the vector to check against
* @returns {Boolean} {@true it is orthogonal}
* @return {Boolean} {@true it is orthogonal}
*/
isOrthogonal: function(point) {
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.
*
* @returns {Boolean} {@true if both x and y are 0}
* @return {Boolean} {@true if both x and y are 0}
*/
isZero: function() {
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
* 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() {
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.
*
* @param {Point} point
* @returns {Number} the dot product of the two points
* @return {Number} the dot product of the two points
*/
dot: function(/* point */) {
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.
*
* @param {Point} point
* @returns {Number} the cross product of the two points
* @return {Number} the cross product of the two points
*/
cross: function(/* point */) {
var point = Point.read(arguments);
@ -763,7 +763,7 @@ var Point = Base.extend(/** @lends Point# */{
* Both points are interpreted as vectors.
*
* @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 */) {
var point = Point.read(arguments);
@ -855,7 +855,7 @@ var Point = Base.extend(/** @lends Point# */{
* @static
* @param {Point} point1
* @param {Point} point2
* @returns {Point} the newly created point object
* @return {Point} the newly created point object
*
* @example
* var point1 = new Point(10, 100);
@ -879,7 +879,7 @@ var Point = Base.extend(/** @lends Point# */{
* @static
* @param {Point} point1
* @param {Point} point2
* @returns {Point} the newly created point object
* @return {Point} the newly created point object
*
* @example
* 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
* between {@code 0} and {@code 1}.
*
* @returns {Point} the newly created point object
* @return {Point} the newly created point object
* @static
*
* @example

View file

@ -459,7 +459,7 @@ var Size = Base.extend(/** @lends Size# */{
* @static
* @param {Size} size1
* @param {Size} size2
* @returns {Size} the newly created size object
* @return {Size} the newly created size object
*
* @example
* var size1 = new Size(10, 100);
@ -480,7 +480,7 @@ var Size = Base.extend(/** @lends Size# */{
* @static
* @param {Size} size1
* @param {Size} size2
* @returns {Size} the newly created size object
* @return {Size} the newly created size object
*
* @example
* 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}
* values between {@code 0} and {@code 1}.
*
* @returns {Size} the newly created size object
* @return {Size} the newly created size object
* @static
*
* @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 {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}
*/
_initialize: function(props, point) {
@ -1641,7 +1641,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
// TEST:
/**
* @param {Rectangle} rect the rectangle to check against
* @returns {Boolean}
* @return {Boolean}
*/
isInside: function(/* rect */) {
return Rectangle.read(arguments).contains(this.getBounds());
@ -1664,7 +1664,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
// TEST:
/**
* @param {Item} item the item to check against
* @returns {Boolean}
* @return {Boolean}
*/
intersects: function(item, _matrix) {
if (!(item instanceof Item))
@ -1831,9 +1831,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* @name Item#matches
* @function
*
* @see #getItems(match)
* @param {Object} match the criteria to match against.
* @return {@true if the item matches all the criteria}
* @see #getItems(match)
*/
/**
* 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
* @function
*
* @see #getItems(match)
* @param {String} name the name of the state to match against.
* @param {Object} compare the value, function or regular expression to
* compare against.
* @return {@true if the item matches the state}
* @see #getItems(match)
*/
matches: function(name, compare) {
// 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
* need to at least partly overlap.
*
* @see #matches(match)
* @param {Object} match the criteria to match against.
* @return {Item[]} the list of matching descendant items.
* @see #matches(match)
*/
getItems: function(match) {
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
* examples.
*
* @see #getItems(match)
* @param {Object} match the criteria to match against.
* @return {Item} the first descendant item matching the given criteria.
* @see #getItems(match)
*/
getItem: function(match) {
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}
* 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}
* @ignore
*/
// TODO: Item#isEditable is currently ignored in the documentation, as
// locking an item currently has no effect
isEditable: function() {
var item = this;
while (item) {