phetsims / normal-modes

"Normal Modes" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 2 forks source link

document viewOrigin #53

Closed pixelzoom closed 4 years ago

pixelzoom commented 4 years ago

Noticed while working on #40.

Both ScreenView subclasses define viewOrigin. The computation of the value is a little complicated, so comments would be nice here.

OneDimensionScreenView.js:

      const viewOrigin = new Vector2( VIEWBOX_WIDTH / 2 + OneDimensionConstants.SCREEN_VIEW_X_MARGIN + 4,
        ( this.layoutBounds.maxY - 2 * OneDimensionConstants.SCREEN_VIEW_Y_MARGIN - 300 ) / 2 + OneDimensionConstants.SCREEN_VIEW_Y_MARGIN );

TwoDimensionsScreenView.js:

      const viewOrigin = new Vector2( ( this.layoutBounds.maxX - 2 * TwoDimensionsConstants.SCREEN_VIEW_X_MARGIN - 420 ) / 2 + TwoDimensionsConstants.SCREEN_VIEW_X_MARGIN,
        ( this.layoutBounds.maxY - 2 * TwoDimensionsConstants.SCREEN_VIEW_Y_MARGIN ) / 2 + TwoDimensionsConstants.SCREEN_VIEW_Y_MARGIN );
pixelzoom commented 4 years ago

I went ahead and added documentation in the above commit. Please review, feel free to change if the description is inaccurate or you'd prefer something else.

Hyodar commented 4 years ago

That's fine with me. What do you think, @tmildemberger?

tmildemberger commented 4 years ago

Looks good.

Hyodar commented 4 years ago

Since it's already ready for review, I'll go ahead and close it.