Преглед изворни кода

Object3D: Renamed removeAll to clear.

Mr.doob пре 4 година
родитељ
комит
315d0fc94b

+ 1 - 1
docs/api/en/core/Object3D.html

@@ -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>

+ 1 - 1
src/core/Object3D.d.ts

@@ -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.

+ 1 - 1
src/core/Object3D.js

@@ -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 ++ ) {
 

+ 2 - 2
test/unit/src/core/Object3D.tests.js

@@ -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" );