Skip to content

Commit

Permalink
add margin to reset all and control panel; factor margin out into con…
Browse files Browse the repository at this point in the history
…stant, see #174
  • Loading branch information
aaronsamuel137 committed Nov 9, 2015
1 parent 0f86e68 commit fa7ca84
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions js/gravity-and-orbits/view/GravityAndOrbitsScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ define( function( require ) {
var SpeedRadioButtons = require( 'GRAVITY_AND_ORBITS/gravity-and-orbits/view/bottom-control-panel/SpeedRadioButtons' );
var MassControlPanel = require( 'GRAVITY_AND_ORBITS/gravity-and-orbits/view/right-control-panel/MassControlPanel' );

// constants
var MARGIN = 5;

/**
* Constructor for GravityAndOrbitsScreenView. Unlike most PhET ScreenView files, this ScreenView takes a module
* object as a parameter instead of a model. This seemed like the easiest way to port the Java version, which has
Expand All @@ -31,17 +34,17 @@ define( function( require ) {

// Add the right control panel
var controlPanelNode = new RightControlPanel( module, {
top: this.layoutBounds.top + 5,
right: this.layoutBounds.maxX
top: this.layoutBounds.top + MARGIN,
right: this.layoutBounds.right - MARGIN
} );

// Add the canvases, one for each of the four modes
var modes = module.getModes();
for ( var i = 0; i < modes.length; i++ ) {
var gaoCanvas = modes[ i ].canvas;
var massControlPanel = new MassControlPanel( modes[ i ].getMassSettableBodies(), {
top: controlPanelNode.bottom + 5,
right: this.layoutBounds.maxX
top: controlPanelNode.bottom + MARGIN,
right: this.layoutBounds.right - MARGIN
} );
modes[ i ].massControlPanel = massControlPanel;

Expand Down Expand Up @@ -70,15 +73,15 @@ define( function( require ) {

// Add the speed control slider.
this.addChild( new SpeedRadioButtons( module.timeSpeedScaleProperty,
{ bottom: this.layoutBounds.bottom - 5, left: this.layoutBounds.left + 5, scale: 1.2 } ) );
{ bottom: this.layoutBounds.bottom - MARGIN, left: this.layoutBounds.left + MARGIN, scale: 1.2 } ) );

// Create and add the Reset All Button in the bottom right, which resets the model
var resetAllButton = new ResetAllButton( {
listener: function() {
module.reset();
},
right: this.layoutBounds.right,
bottom: this.layoutBounds.bottom - 5
right: this.layoutBounds.right - MARGIN,
bottom: this.layoutBounds.bottom - MARGIN
} );
this.addChild( resetAllButton );
}
Expand Down

0 comments on commit fa7ca84

Please sign in to comment.