Skip to content

Commit

Permalink
Object3D: Add childadded and childremoved events. (#16934)
Browse files Browse the repository at this point in the history
* Add addchild and removechild events

* rename events
  • Loading branch information
gkjohnson authored Feb 16, 2024
1 parent 109c87f commit a15b926
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/Object3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ class Object3D extends EventDispatcher {
this.children.push( object );

object.dispatchEvent( _addedEvent );
this.dispatchEvent( { type: 'childadded', child: object } );

} else {

Expand Down Expand Up @@ -373,6 +374,7 @@ class Object3D extends EventDispatcher {
this.children.splice( index, 1 );

object.dispatchEvent( _removedEvent );
this.dispatchEvent( { type: 'childremoved', child: object } );

}

Expand Down

0 comments on commit a15b926

Please sign in to comment.