提交 315d0fc9 编写于 作者: M Mr.doob

Object3D: Renamed removeAll to clear.

上级 2b082dc5
......@@ -314,7 +314,7 @@
Removes *object* as child of this object. An arbitrary number of objects may be removed.
</p>
<h3>[method:this removeAll]()</h3>
<h3>[method:this clear]()</h3>
<p>
Removes all child objects.
</p>
......
......@@ -319,7 +319,7 @@ export class Object3D extends EventDispatcher {
/**
* Removes all child objects.
*/
removeAll(): this;
clear(): this;
/**
* Adds object as a child of this, while maintaining the object's world transform.
......
......@@ -370,7 +370,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
},
removeAll: function () {
clear: function () {
for ( let i = 0; i < this.children.length; i ++ ) {
......
......@@ -296,7 +296,7 @@ export default QUnit.module( 'Core', () => {
} );
QUnit.test( "add/remove/removeAll", ( assert ) => {
QUnit.test( "add/remove/clear", ( assert ) => {
var a = new Object3D();
var child1 = new Object3D();
......@@ -330,7 +330,7 @@ export default QUnit.module( 'Core', () => {
a.add( child1 );
assert.strictEqual( a.children.length, 2, "The first child was added to the parent" );
a.removeAll();
a.clear();
assert.strictEqual( a.children.length, 0, "All childrens were removed" );
assert.strictEqual( child1.parent, null, "First child has no parent" );
assert.strictEqual( child2.parent, null, "Second child has no parent" );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册