Skip to content

Commit

Permalink
Added geometry and material dispose to TransformControls.dispose().
Browse files Browse the repository at this point in the history
  • Loading branch information
arodic committed Mar 26, 2019
1 parent 7946bd5 commit 0f39a18
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions examples/js/controls/TransformControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ THREE.TransformControls = function ( camera, domElement ) {
domElement.removeEventListener( "touchcancel", onPointerUp );
domElement.removeEventListener( "touchleave", onPointerUp );

this.traverse( function( object ) {

if ( object.material ) {

object.material.dispose();

}
if ( object.geometry ) {

object.geometry.dispose();

}

} );

};

// Set current object
Expand Down
4 changes: 2 additions & 2 deletions examples/misc_controls_transform.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
line-height: 30px;
overflow: hidden;
}

#info {
position: absolute;
top: 0px; width: 100%;
padding: 15px;
z-index:100;
box-sizing: border-box;
}

a {
color: white;
}
Expand Down

0 comments on commit 0f39a18

Please sign in to comment.