Skip to content

Commit

Permalink
Eliminated memory leak, see #64
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Feb 14, 2018
1 parent b04dc52 commit d86c305
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/friction/view/magnifier/AtomNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ define( function( require ) {
* TODO: visibility annotation and documentation
*/
evaporate: function() {
assert && assert( !this.isEvaporated, 'AtomNode was already evaporated' );
var self = this;

this.isEvaporated = true;
Expand All @@ -125,8 +126,7 @@ define( function( require ) {
self.originX += dx;
self.originY -= dy;

// TODO: memory leak for atoms moving to the left?
if ( self.originX > 4 * self.model.width ) {
if ( Math.abs( self.originX ) > 4 * self.model.width ) {
self.model.stepEmitter.removeListener( self.handler );
self.setVisible( false );
}
Expand Down

0 comments on commit d86c305

Please sign in to comment.