phetsims / blackbody-spectrum

"Blackbody Spectrum" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
1 stars 3 forks source link

possible problem with changing localBounds #3

Closed pixelzoom closed 9 years ago

pixelzoom commented 9 years ago

In GraphDrawingNode:

    // expand touch area
    horizontalZoomInButton.touchArea = horizontalZoomInButton.localBounds.dilate( 5, 5 );
    horizontalZoomOutButton.touchArea = horizontalZoomOutButton.localBounds.dilate( 5, 5 );
    verticalZoomInButton.touchArea = verticalZoomInButton.localBounds.dilate( 5, 5 );
    verticalZoomOutButton.touchArea = verticalZoomOutButton.localBounds.dilate( 5, 5 );

This code will likely become buggy when scenery bounds become mutable. Recommended to change dilate calls to dilated, so that you're operating on a copy of localBounds, and not localBounds themselves.

veillette commented 9 years ago

Thanks @pixelzoom. Change to dilated method instead. Closing