From f2216af33a804f94f44185e65949f30b7dc32c93 Mon Sep 17 00:00:00 2001 From: Knox Date: Fri, 7 Sep 2018 10:37:35 +0800 Subject: [PATCH] update node api (#3213) --- cocos2d/core/CCNode.js | 6 +++--- cocos2d/core/utils/base-node.js | 21 ++++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index e0aeaa1b4f..b2b30a87bb 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -860,7 +860,7 @@ var Node = cc.Class({ /** * !#en Skew x - * !#zh 该节点 Y 轴倾斜角度。 + * !#zh 该节点 X 轴倾斜角度。 * @property skewX * @type {Number} * @example @@ -880,7 +880,7 @@ var Node = cc.Class({ /** * !#en Skew y - * !#zh 该节点 X 轴倾斜角度。 + * !#zh 该节点 Y 轴倾斜角度。 * @property skewY * @type {Number} * @example @@ -2296,7 +2296,7 @@ var Node = cc.Class({ * Set world position. * This is not a public API yet, its usage could be updated * @method setWorldPos - * @param {vec3} pos + * @param {Vec3} pos */ setWorldPos (pos) { // NOTE: this is faster than invert world matrix and transform the point diff --git a/cocos2d/core/utils/base-node.js b/cocos2d/core/utils/base-node.js index 7e72ba3416..17139e3403 100644 --- a/cocos2d/core/utils/base-node.js +++ b/cocos2d/core/utils/base-node.js @@ -338,18 +338,25 @@ var BaseNode = cc.Class({ }, /** - * !#en The parent of the node. - * !#zh 该节点的父节点。 - * @property parent - * @type {Node} - * @default null + * !#en Get parent of the node. + * !#zh 获取该节点的父节点。 + * @method getParent + * @return {Node} * @example - * node.parent = newNode; + * var parent = this.node.getParent(); */ getParent () { return this._parent; }, + /** + * !#en Set parent of the node. + * !#zh 设置该节点的父节点。 + * @method setParent + * @param {Node} value + * @example + * node.setParent(newNode); + */ setParent (value) { if (this._parent === value) { return; @@ -501,7 +508,7 @@ var BaseNode = cc.Class({ * !#en Get the sibling index. * !#zh 获取同级索引。 * @method getSiblingIndex - * @return {number} + * @return {Number} * @example * var index = node.getSiblingIndex(); */