Skip to content

Commit

Permalink
Removed unnecessary dispose in EquationNode
Browse files Browse the repository at this point in the history
See #158
  • Loading branch information
SaurabhTotey authored and SaurabhTotey committed Aug 30, 2019
1 parent eb86e66 commit 9c2e121
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions js/curve-fitting/view/EquationNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,16 @@ define( require => {
);
this.setCoefficients( initialCoefficients );

// links the visibility of terms to the order of the equation
const visibilityUpdater = order => {
// links the visibility of terms to the order of the equation; unlink unnecessary: all instances present for sim life
this.orderProperty.link( order => {
for ( let i = 0; i <= CurveFittingConstants.MAX_ORDER_OF_FIT; i++ ) {
const isVisible = i <= order;
this.signTextNodes[ i ].visible = isVisible;
this.coefficientTextNodes[ i ].visible = isVisible;
this.xVariableTextNodes[ i ].visible = isVisible;
}
this.updateChildrenAndVisibilities();
};
this.orderProperty.link( visibilityUpdater );

// @private
this.disposeVisibilityUpdater = () => { this.orderProperty.unlink( visibilityUpdater ); };
} );

}

Expand Down Expand Up @@ -174,15 +170,6 @@ define( require => {

}

/**
* @override
* @public
*/
dispose() {
this.disposeVisibilityUpdater();
super.dispose();
}

}

return curveFitting.register( 'EquationNode', EquationNode );
Expand Down

0 comments on commit 9c2e121

Please sign in to comment.