提交 87f6fed4 编写于 作者: M Mugen87

Object3D: Dispatch event in .add()/.remove() when operation is done.

上级 ee2149ff
......@@ -389,10 +389,10 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
}
object.parent = this;
object.dispatchEvent( { type: 'added' } );
this.children.push( object );
object.dispatchEvent( { type: 'added' } );
} else {
console.error( "THREE.Object3D.add: object not an instance of THREE.Object3D.", object );
......@@ -422,11 +422,10 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
if ( index !== - 1 ) {
object.parent = null;
this.children.splice( index, 1 );
object.dispatchEvent( { type: 'removed' } );
this.children.splice( index, 1 );
}
return this;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册