Skip to content

Commit 4015b02

Browse files
committed
Docs: use @true tag in boolean return descriptions and add Key.isDown param options.
1 parent b98f69a commit 4015b02

9 files changed

Lines changed: 46 additions & 52 deletions

File tree

src/basic/Point.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,7 @@ var Point = this.Point = Base.extend({
521521
* Checks whether the point is inside the boundaries of the rectangle.
522522
*
523523
* @param {Rectangle} rect the rectangle to check against
524-
* @returns {boolean} true if the point is inside the rectangle, false
525-
* otherwise.
524+
* @returns {boolean} {@true if the point is inside the rectangle}
526525
*/
527526
isInside: function(rect) {
528527
return rect.contains(this);
@@ -533,8 +532,7 @@ var Point = this.Point = Base.extend({
533532
*
534533
* @param {Point} point the point to check against
535534
* @param {number} tolerance the maximum distance allowed
536-
* @returns {boolean} true if it is within the given distance, false
537-
* otherwise.
535+
* @returns {boolean} {@true if it is within the given distance}
538536
*/
539537
isClose: function(point, tolerance) {
540538
return this.getDistance(point) < tolerance;
@@ -545,7 +543,7 @@ var Point = this.Point = Base.extend({
545543
* another vector.
546544
*
547545
* @param {Point} point the vector to check against
548-
* @returns {boolean} true if it is parallel, false otherwise.
546+
* @returns {boolean} {@true it is parallel}
549547
*/
550548
isColinear: function(point) {
551549
return this.cross(point) < Numerical.TOLERANCE;
@@ -556,7 +554,7 @@ var Point = this.Point = Base.extend({
556554
* (perpendicular) to another vector.
557555
*
558556
* @param {Point} point the vector to check against
559-
* @returns {boolean} true if it is orthogonal, false otherwise.
557+
* @returns {boolean} {@true it is orthogonal}
560558
*/
561559
isOrthogonal: function(point) {
562560
return this.dot(point) < Numerical.TOLERANCE;
@@ -565,7 +563,7 @@ var Point = this.Point = Base.extend({
565563
/**
566564
* Checks if this point has both the x and y coordinate set to 0.
567565
*
568-
* @returns {boolean} true if both x and y are 0, false otherwise.
566+
* @returns {boolean} {@true both x and y are 0}
569567
*/
570568
isZero: function() {
571569
return this.x == 0 && this.y == 0;
@@ -575,8 +573,7 @@ var Point = this.Point = Base.extend({
575573
* Checks if this point has an undefined value for at least one of its
576574
* coordinates.
577575
*
578-
* @returns {boolean} true if either x or y are not a number, false
579-
* otherwise.
576+
* @returns {boolean} {@true if either x or y are not a number}
580577
*/
581578
isNaN: function() {
582579
return isNaN(this.x) || isNaN(this.y);
@@ -628,11 +625,11 @@ var Point = this.Point = Base.extend({
628625
/**
629626
* This property is only present if the point is an anchor or control point
630627
* of a {@link Segment} or a {@link Curve}. In this case, it returns
631-
* true if it is selected, false otherwise
628+
* {@true it is selected}
632629
*
633630
* @name Point#selected
634631
* @property
635-
* @return {boolean} true if the point is selected, false otherwise
632+
* @return {boolean} {@true the point is selected}
636633
*/
637634

638635
statics: {

src/basic/Rectangle.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ var Rectangle = this.Rectangle = Base.extend({
337337
},
338338

339339
/**
340-
* @return {boolean} true if the rectangle is empty, false otherwise.
340+
* @return {boolean} {@true the rectangle is empty}
341341
*/
342342
isEmpty: function() {
343343
return this.width == 0 || this.height == 0;
@@ -363,16 +363,15 @@ var Rectangle = this.Rectangle = Base.extend({
363363
* @name Rectangle#contains^2
364364
* @function
365365
* @param {Point} point the specified point
366-
* @return {boolean} true if the point is inside the rectangle's
367-
* boundary, false otherwise
366+
* @return {boolean} {@true if the point is inside the rectangle's boundary}
368367
*/
369368
/**
370369
* Tests if the interior of the rectangle entirely contains the specified
371370
* rectangle.
372371
*
373372
* @param {Rectangle} rect The specified rectangle
374-
* @return {boolean} true if the rectangle entirely contains the
375-
* specified rectangle, false otherwise
373+
* @return {boolean} {@true if the rectangle entirely contains the specified
374+
* rectangle}
376375
*/
377376
contains: function(rect) {
378377
if (rect.width !== undefined) {
@@ -392,8 +391,8 @@ var Rectangle = this.Rectangle = Base.extend({
392391
* another rectangle.
393392
*
394393
* @param {Rectangle} rect the specified rectangle
395-
* @return {boolean} true if the rectangle and the specified rectangle
396-
* intersect each other, false otherwise
394+
* @return {boolean} {@true if the rectangle and the specified rectangle
395+
* intersect each other}
397396
*/
398397
intersects: function(rect) {
399398
rect = Rectangle.read(arguments);

src/basic/Size.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ var Size = this.Size = Base.extend({
287287
* {@grouptitle Tests}
288288
* Checks if this size has both the width and height set to 0.
289289
*
290-
* @return {boolean} true if both width and height are 0, false otherwise.
290+
* @return {boolean} {@true both width and height are 0}
291291
*/
292292
isZero: function() {
293293
return this.width == 0 && this.width == 0;
@@ -296,8 +296,7 @@ var Size = this.Size = Base.extend({
296296
/**
297297
* Checks if the width or the height of the size are NaN.
298298
*
299-
* @return {boolean} true if the width or height of the size are NaN, false
300-
* otherwise.
299+
* @return {boolean} {@true if the width or height of the size are NaN}
301300
*/
302301
isNaN: function() {
303302
return isNaN(this.width) || isNaN(this.height);

src/color/Color.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ var Color = this.Color = Base.extend(new function() {
300300
/**
301301
* Checks if the color has an alpha value.
302302
*
303-
* @return true if the color has an alpha value, false otherwise.
303+
* @return {@true if the color has an alpha value}
304304
*/
305305
hasAlpha: function() {
306306
return this._alpha != null;
@@ -311,7 +311,7 @@ var Color = this.Color = Base.extend(new function() {
311311
* same as those of the supplied one.
312312
*
313313
* @param obj the GrayColor to compare with
314-
* @return true if the GrayColor is the same, false otherwise.
314+
* @return {@true if the GrayColor is the same}
315315
*/
316316
equals: function(color) {
317317
if (color && color._colorType === this._colorType) {

src/color/Gradient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ var Gradient = this.Gradient = Base.extend({
7272
* Checks whether the gradient is equal to the supplied gradient.
7373
*
7474
* @param {Gradient} gradient
75-
* @return {boolean} true if they are equal, false otherwise
75+
* @return {boolean} {@true they are equal}
7676
*/
7777
equals: function(gradient) {
7878
if (gradient.type != this.type)

src/color/GradientColor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ var GradientColor = this.GradientColor = Color.extend({
128128
* supplied one.
129129
*
130130
* @param {GradientColor} color
131-
* @return true if the GradientColor is the same, false otherwise
131+
* @return {@true the GradientColor is the same}
132132
*/
133133
equals: function(color) {
134134
return color == this || color && color._colorType === this._colorType

src/item/Item.js

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ var Item = this.Item = Base.extend({
177177
* path.selected = true; // Select the path
178178
* console.log(project.selectedItems.length) // 1
179179
*
180-
* @type boolean true if the item is selected, false otherwise
180+
* @type boolean {@true the item is selected}
181181
* @bean
182182
*/
183183
isSelected: function() {
@@ -231,7 +231,7 @@ var Item = this.Item = Base.extend({
231231
* console.log(path.visible) // true
232232
* path.visible = false; // Hides the path
233233
*
234-
* @type boolean true if the item is visible, false otherwise
234+
* @type boolean {@true the item is visible}
235235
* @default true
236236
*/
237237
visible: true,
@@ -455,7 +455,7 @@ var Item = this.Item = Base.extend({
455455
* Removes the item from the project. If the item has children, they are also
456456
* removed.
457457
*
458-
* @return {boolean} true if the item was removed, false otherwise
458+
* @return {boolean} {@true the item was removed}
459459
*/
460460
remove: function() {
461461
if (this.isSelected())
@@ -466,7 +466,7 @@ var Item = this.Item = Base.extend({
466466
/**
467467
* Removes all of the item's children (if any).
468468
*
469-
* @return {boolean} true if removing was successful, false otherwise
469+
* @return {boolean} {@true removing was successful}
470470
*/
471471
removeChildren: function() {
472472
var removed = false;
@@ -535,7 +535,7 @@ var Item = this.Item = Base.extend({
535535
/**
536536
* Reverses the order of this item's children
537537
*
538-
* @return {boolean} true if the children were removed, false otherwise.
538+
* @return {boolean} {@true the children were removed}
539539
*/
540540
reverseChildren: function() {
541541
if (this._children) {
@@ -575,7 +575,7 @@ var Item = this.Item = Base.extend({
575575
* {@grouptitle Tests}
576576
* Checks if the item contains any children items.
577577
*
578-
* @return {boolean} true if it has one or more children, false otherwise.
578+
* @return {boolean} {@true it has one or more children}
579579
*/
580580
hasChildren: function() {
581581
return this._children && this._children.length > 0;
@@ -586,8 +586,8 @@ var Item = this.Item = Base.extend({
586586
/**
587587
* Checks whether the item is editable.
588588
*
589-
* @return {boolean} true when neither the item, nor its parents are
590-
* locked or hidden, false otherwise.
589+
* @return {boolean} {@true when neither the item, nor its parents are
590+
* locked or hidden}
591591
* @ignore
592592
*/
593593
isEditable: function() {
@@ -603,7 +603,7 @@ var Item = this.Item = Base.extend({
603603
/**
604604
* Checks whether the item is valid, i.e. it hasn't been removed.
605605
*
606-
* @return {boolean} true if the item is valid, false otherwise.
606+
* @return {boolean} {@true the item is valid}
607607
*/
608608
// TODO: isValid / checkValid
609609

@@ -612,8 +612,7 @@ var Item = this.Item = Base.extend({
612612
* of the project.
613613
*
614614
* @param {Item} item The item to check against
615-
* @return {boolean} true if it is above the specified item, false
616-
* otherwise.
615+
* @return {boolean} {@true if it is above the specified item}
617616
*/
618617
// TODO: isAbove
619618

@@ -622,8 +621,7 @@ var Item = this.Item = Base.extend({
622621
* the project.
623622
*
624623
* @param {Item} item The item to check against
625-
* @return {boolean} true if it is below the specified item, false
626-
* otherwise.
624+
* @return {boolean} {@true if it is below the specified item}
627625
*/
628626
// TODO: isBelow
629627

@@ -632,8 +630,7 @@ var Item = this.Item = Base.extend({
632630
* Checks whether the specified item is the parent of the item.
633631
*
634632
* @param {Item} item The item to check against
635-
* @return {boolean} true if it is the parent of the item, false
636-
* otherwise.
633+
* @return {boolean} {@true if it is the parent of the item}
637634
*/
638635
isParent: function(item) {
639636
return this._parent == item;
@@ -643,7 +640,7 @@ var Item = this.Item = Base.extend({
643640
* Checks whether the specified item is a child of the item.
644641
*
645642
* @param {Item} item The item to check against
646-
* @return {boolean} true if it is a child of the item, false otherwise.
643+
* @return {boolean} {@true it is a child of the item}
647644
*/
648645
isChild: function(item) {
649646
return item._parent == this;
@@ -653,8 +650,7 @@ var Item = this.Item = Base.extend({
653650
* Checks if the item is contained within the specified item.
654651
*
655652
* @param {Item} item The item to check against
656-
* @return {boolean} true if it is inside the specified item, false
657-
* otherwise.
653+
* @return {boolean} {@true if it is inside the specified item}
658654
*/
659655
isDescendant: function(item) {
660656
var parent = this;
@@ -669,8 +665,8 @@ var Item = this.Item = Base.extend({
669665
* Checks if the item is an ancestor of the specified item.
670666
*
671667
* @param {Item} item the item to check against
672-
* @return {boolean} true if the item is an ancestor of the specified
673-
* item, false otherwise.
668+
* @return {boolean} {@true if the item is an ancestor of the specified
669+
* item}
674670
*/
675671
isAncestor: function(item) {
676672
var parent = item;
@@ -685,8 +681,7 @@ var Item = this.Item = Base.extend({
685681
* Checks whether the item is grouped with the specified item.
686682
*
687683
* @param {Item} item
688-
* @return {boolean} true if the items are grouped together, false
689-
* otherwise.
684+
* @return {boolean} {@true if the items are grouped together}
690685
*/
691686
isGroupedWith: function(item) {
692687
var parent = this._parent;
@@ -1082,7 +1077,7 @@ var Item = this.Item = Base.extend({
10821077
*
10831078
* @function
10841079
* @param {Item} item The item above which it should be moved
1085-
* @return {boolean} true if it was moved, false otherwise
1080+
* @return {boolean} {@true it was moved}
10861081
*/
10871082
moveAbove: move(true),
10881083

@@ -1091,7 +1086,7 @@ var Item = this.Item = Base.extend({
10911086
*
10921087
* @function
10931088
* @param {Item} item the item below which it should be moved
1094-
* @return {boolean} true if it was moved, false otherwise
1089+
* @return {boolean} {@true it was moved}
10951090
*/
10961091
moveBelow: move(false)
10971092
};

src/path/Curve.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ var Curve = this.Curve = Base.extend({
234234
* Checks if this curve is linear, meaning it does not define any curve
235235
* handle.
236236
237-
* @return {boolean} true if the curve is linear, false otherwise.
237+
* @return {boolean} {@true the curve is linear}
238238
*/
239239
isLinear: function() {
240240
return this._segment1._handleOut.isZero()
@@ -246,7 +246,7 @@ var Curve = this.Curve = Base.extend({
246246
/**
247247
* @param {number} length
248248
* @param {number} [start]
249-
* @return {boolean} true if the curve is linear, false otherwise.
249+
* @return {boolean} {@true the curve is linear}
250250
*/
251251
getParameter: function(length, start) {
252252
var args = this.getCurveValues();

src/ui/Key.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ var Key = this.Key = new function() {
144144
* console.log('The shift key is currently pressed.')
145145
* }
146146
* }
147-
* @return {boolean} true if the key is pressed, false otherwise
147+
*
148+
* @param {string} key One of: 'backspace', 'enter', 'shift', 'control',
149+
* 'option', 'pause', 'caps-lock', 'escape', 'space', 'end', 'home',
150+
* 'left', 'up', 'right', 'down', 'delete', 'command'
151+
* @return {boolean} {@true if the key is pressed}
148152
*/
149153
isDown: function(key) {
150154
return !!keyMap[key];

0 commit comments

Comments
 (0)