Merge pull request #44 from shrinktofit/opt-node-api

optimize cc.Node api
This commit is contained in:
Weiliang Wang
2019-01-14 17:35:09 +08:00
committed by GitHub
+88 -5
View File
@@ -275,6 +275,21 @@ class Node extends BaseNode {
// transform
// ===============================
/**
* Sets local position.
* @param position - The new local position.
*/
public setPosition (position: Vec3): void;
/**
* Sets local position.
* @param x - The x component of the new local position.
* @param y - The y component of the new local position.
* @param z - The z component of the new local position.
* @param w - The w component of the new local position.
*/
public setPosition (x: number, y?: number, z?: number, w?: number): void;
/**
* set local position
* @param val - the new local position, or the x component of it
@@ -307,12 +322,20 @@ class Node extends BaseNode {
}
/**
* set local rotation
* @param val - the new local rotation, or the x component of it
* @param y - the y component of the new local rotation
* @param z - the z component of the new local rotation
* @param w - the w component of the new local rotation
* Sets local rotation.
* @param rotation - The new local rotation.
*/
public setRotation (rotation: Quat): void;
/**
* Sets local rotation.
* @param x - The x component of the new local rotation.
* @param y - The y component of the new local rotation.
* @param z - The z component of the new local rotation.
* @param w - The w component of the new local rotation.
*/
public setRotation (x: number, y?: number, z?: number, w?: number): void;
public setRotation (val: Quat | number, y?: number, z?: number, w?: number) {
if (y === undefined || z === undefined || w === undefined) {
quat.copy(this._lrot, val);
@@ -355,6 +378,21 @@ class Node extends BaseNode {
}
}
/**
* Sets local scale.
* @param scale - The new local scale.
*/
public setScale (scale: Vec3): void;
/**
* Sets local scale.
* @param x - The x component of the new local scale.
* @param y - The y component of the new local scale.
* @param z - The z component of the new local scale.
* @param w - The w component of the new local scale.
*/
public setScale (x: number, y?: number, z?: number, w?: number): void;
/**
* set local scale
* @param val - the new local scale, or the x component of it
@@ -386,6 +424,21 @@ class Node extends BaseNode {
}
}
/**
* Sets world position.
* @param position - The new world position.
*/
public setWorldPosition (position: Vec3): void;
/**
* Sets world position.
* @param x - The x component of the new world position.
* @param y - The y component of the new world position.
* @param z - The z component of the new world position.
* @param w - The w component of the new world position.
*/
public setWorldPosition (x: number, y?: number, z?: number, w?: number): void;
/**
* set world position
* @param val - the new world position, or the x component of it
@@ -427,6 +480,21 @@ class Node extends BaseNode {
}
}
/**
* Sets world rotation.
* @param rotation - The new world rotation.
*/
public setWorldRotation (rotation: Quat): void;
/**
* Sets world rotation.
* @param x - The x component of the new world rotation.
* @param y - The y component of the new world rotation.
* @param z - The z component of the new world rotation.
* @param w - The w component of the new world rotation.
*/
public setWorldRotation (x: number, y?: number, z?: number, w?: number): void;
/**
* set world rotation
* @param val - the new world rotation, or the x component of it
@@ -487,6 +555,21 @@ class Node extends BaseNode {
}
}
/**
* Sets world scale.
* @param scale - The new world scale.
*/
public setWorldScale (scale: Vec3): void;
/**
* Sets world scale.
* @param x - The x component of the new world scale.
* @param y - The y component of the new world scale.
* @param z - The z component of the new world scale.
* @param w - The w component of the new world scale.
*/
public setWorldScale (x: number, y?: number, z?: number, w?: number): void;
/**
* set world scale
* @param val - the new world scale, or the x component of it