Permalink
Browse files

issue #1447 JsDoc for V2.0

  • Loading branch information...
1 parent a3312d5 commit a8bf3c8753ae05782514b821b999300e0ec9b4a4 @dingpinglv dingpinglv committed Aug 27, 2012
@@ -687,14 +687,14 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
this._parent = Var;
},
- /** isIgnoreAnchorPointForPosition getter
+ /** ignoreAnchorPointForPosition getter
* @return {Boolean}
*/
isIgnoreAnchorPointForPosition:function () {
return this._ignoreAnchorPointForPosition;
},
- /** isRelativeAnchorPoint setter
+ /** ignoreAnchorPointForPosition setter
* @param {Boolean} newValue
*/
ignoreAnchorPointForPosition:function (newValue) {
@@ -857,7 +857,6 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
* cc.Scheduler used to schedule all "updates" and timers.<br/>
* IMPORTANT: If you set a new cc.Scheduler, then previously created timers/update are going to be removed.
* </p>
- * @return {cc.Scheduler}
*/
setScheduler:function (scheduler) {
if (this._scheduler != scheduler) {
@@ -868,14 +867,14 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
/** returns a "local" axis aligned bounding box of the node. <br/>
* The returned box is relative only to its parent.
- * @return {Number}
+ * @return {cc.rect}
*/
getBoundingBox:function () {
var rect = cc.rect(0, 0, this._contentSize.width, this._contentSize.height);
return cc.RectApplyAffineTransform(rect, this.nodeToParentTransform());
},
- /**
+ /** returns a "world" axis aligned bounding box of the node. <br/>
* @return {cc.Rect}
*/
getBoundingBoxToWorld:function () {
@@ -909,7 +908,7 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
this._arrayMakeObjectsPerformSelector(this._children, cc.Node.StateCallbackType.cleanup);
},
- /**
+ /** Node description
* @return {String}
*/
description:function () {
@@ -1655,11 +1654,6 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
return this.convertToWorldSpace(pt);
},
- /**
- * @param nodePoint
- * @return {cc.Point}
- * @private
- */
_convertToWindowSpace:function (nodePoint) {
var worldPoint = this.convertToWorldSpace(nodePoint);
return cc.Director.getInstance().convertToUI(worldPoint);
@@ -158,7 +158,7 @@ cc.AffineTransformTranslate = function (t, tx, ty) {
* @param {cc.AffineTransform} t
* @param {Number} sx
* @param {Number} sy
- * @return {{cc.AffineTransform}}
+ * @return {cc.AffineTransform}
* Constructor
*/
cc.AffineTransformScale = function (t, sx, sy) {
@@ -332,7 +332,7 @@ cc.size = function (w, h) {
return {width:w, height:h};
// return cc.size(w,h);
-}
+};
/**
* @function
@@ -352,7 +352,7 @@ cc.rect = function (x, y, w, h) {
// optimization
return { origin:{x:x, y:y}, size:{width:w, height:h} };
// return cc.rect(x, y, width, height);
-}
+};
/**
* The "left bottom" point -- equivalent to cc.p(0, 0).
View
@@ -30,18 +30,15 @@
* or the parameter strs will be empty. <br/>
* if the form is right return true,else return false.<br/>
* @function
- * @param {String} str
+ * @param {String} content
* @param {String} strs
* @return {String}
*/
-cc.splitWithForm = function (str, strs) {
- var ret = false;
- do
- {
- if (!str) break;
+cc.splitWithForm = function (content, strs) {
+ do {
+ if (!content) break;
// string is empty
- var content = str;
if (content.length == 0) break;
var posLeft = content.indexOf('{');
@@ -85,10 +82,8 @@ cc.splitWithForm = function (str, strs) {
*/
cc.RectFromString = function (content) {
var result = cc.RectZero();
-
do {
if (!content) break;
- var content = content;
// find the first '{' and the third '}'
var posLeft = content.indexOf('{') + 1;
@@ -105,8 +100,8 @@ cc.RectFromString = function (content) {
var sizeStr = content.substr(nPointEnd + 1, content.length - nPointEnd);
// split the string with ','
- var pointInfo = cc.splitWithForm(pointStr.toString());
- var sizeInfo = cc.splitWithForm(sizeStr.toString());
+ var pointInfo = cc.splitWithForm(pointStr);
+ var sizeInfo = cc.splitWithForm(sizeStr);
var x = parseFloat(pointInfo[0]);
var y = parseFloat(pointInfo[1]);
@@ -116,7 +111,8 @@ cc.RectFromString = function (content) {
result = cc.rect(x, y, width, height);
} while (0);
return result;
-}
+};
+
/**
* Returns a Core Graphics point structure corresponding to the data in a given string.
* @function
@@ -133,7 +129,6 @@ cc.RectFromString = function (content) {
*/
cc.PointFromString = function (content) {
var ret = cc.PointZero();
-
try {
if (content == "")
return ret;
@@ -28,7 +28,6 @@
* @class
* @extends cc.Class
*/
-
cc.Set = cc.Class.extend(/** @lends cc.Set# */{
/**
* Constructor
@@ -90,8 +90,7 @@ cc.LabelAtlas = cc.AtlasNode.extend(/** @lends cc.LabelAtlas# */{
fontChar.initWithTexture(texture, rect);
}
this.addChild(fontChar, 0, i);
- }
- else {
+ } else {
if (c == 32) {
fontChar.init();
fontChar.setTextureRect(cc.rect(0, 0, 10, 10), false, cc.SizeZero());
@@ -143,8 +143,7 @@ cc.BMFontConfiguration = cc.Class.extend(/** @lends cc.BMFontConfiguration# */{
* @return {String}
*/
description:function () {
- var ret = "<cc.BMFontConfiguration | Kernings:" + this.kerningDictionary + " | Image = " + this.atlasName.toString() + ">";
- return ret;
+ return "<cc.BMFontConfiguration | Kernings:" + this.kerningDictionary + " | Image = " + this.atlasName.toString() + ">";
},
/**
@@ -163,7 +162,7 @@ cc.BMFontConfiguration = cc.Class.extend(/** @lends cc.BMFontConfiguration# */{
/**
* initializes a BitmapFontConfiguration with a FNT file
- * @param {String} FNTfile
+ * @param {String} FNT file path
* @return {Boolean}
*/
initWithFNTfile:function (FNTfile) {
@@ -614,28 +613,25 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
if (stringLen == 0) {
return;
}
-
- for (var i = 0; i < stringLen; i++) {
- var c = this._string.charCodeAt(i);
- if (c == 10) {
+ var i;
+ for (i = 0; i < stringLen; i++) {
+ if (this._string.charCodeAt(i) == 10) {
quantityOfLines++;
}
}
totalHeight = this._configuration.commonHeight * quantityOfLines;
nextFontPositionY = -(this._configuration.commonHeight - this._configuration.commonHeight * quantityOfLines);
- for (var i = 0; i < stringLen; i++) {
- var c = this._string.charCodeAt(i);
+ for (i = 0; i < stringLen; i++) {
+ var key = this._string.charCodeAt(i);
- if (c == 10) {
+ if (key == 10) {
nextFontPositionX = 0;
nextFontPositionY -= this._configuration.commonHeight;
continue;
}
- var key = c;
-
var element = this._configuration.fontDefDictionary[key];
cc.Assert(element, "FontDefinition could not be found!");
@@ -649,21 +645,18 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
var fontChar = this.getChildByTag(i);
if (!fontChar) {
fontChar = new cc.Sprite();
- if (c == 32) {
+ if (key == 32) {
fontChar.init();
fontChar.setTextureRect(cc.RectZero(), false, cc.SizeZero());
- }
- else {
+ } else {
fontChar.initWithTexture(this._textureAtlas.getTexture(), rect, false);
}
this.addChild(fontChar, 0, i);
- }
- else {
- if (c == 32) {
+ } else {
+ if (key == 32) {
fontChar.init();
fontChar.setTextureRect(cc.RectZero(), false, cc.SizeZero());
- }
- else {
+ } else {
// reusing fonts
fontChar.initWithTexture(this._textureAtlas.getTexture(), rect, false);
// restore to default in case they were modified
@@ -697,7 +690,6 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
tmpSize.width = longestLine;
tmpSize.height = totalHeight;
this.setContentSize(cc.SIZE_PIXELS_TO_POINTS(tmpSize));
-
},
/**
@@ -1125,7 +1117,7 @@ cc.isspace_unicode = function (ch) {
return ((ch >= 9 && ch <= 13) || ch == 32 || ch == 133 || ch == 160 || ch == 5760
|| (ch >= 8192 && ch <= 8202) || ch == 8232 || ch == 8233 || ch == 8239
|| ch == 8287 || ch == 12288)
-}
+};
/**
* @param {String} str
@@ -1150,7 +1142,7 @@ cc.utf8_trim_ws = function (str) {
}
cc.utf8_trim_from(str, last_index);
}
-}
+};
/**
* Trims str st str=[0, index) after the operation.
@@ -1163,4 +1155,4 @@ cc.utf8_trim_from = function (str, index) {
if (index >= len || index < 0)
return;
str.splice(index, len);
-}
+};
Oops, something went wrong.

0 comments on commit a8bf3c8

Please sign in to comment.