Skip to content

Commit

Permalink
fix combobox alignment, add air resistance icon to checkbox, fix comb…
Browse files Browse the repository at this point in the history
…obox min width, #199
  • Loading branch information
zepumph committed Oct 25, 2019
1 parent c2b11df commit a22c072
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
14 changes: 6 additions & 8 deletions js/intro/view/IntroProjectilePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,15 @@ define( require => {
firstItemNode.addChild( new HStrut( firstItemNodeWidth ) );

const comboBoxItems = [];
assert && assert( objectTypes[ 0 ].benchmark, 'benchmark needed for tandemName' );
comboBoxItems[ 0 ] = new ComboBoxItem( firstItemNode, objectTypes[ 0 ], {
tandemName: objectTypes[ 0 ].benchmark
} );

for ( let i = 1; i < objectTypes.length; i++ ) {
for ( let i = 0; i < objectTypes.length; i++ ) {
const projectileObject = objectTypes[ i ];
assert && assert( projectileObject.benchmark, 'benchmark needed for tandemName' );
comboBoxItems[ i ] = new ComboBoxItem( new Text( projectileObject.name, itemNodeOptions ), projectileObject, {
tandemName: projectileObject.benchmark
} );

comboBoxItems[ i ] = new ComboBoxItem( i === 0 ? firstItemNode : new Text( projectileObject.name, itemNodeOptions ),
projectileObject, {
tandemName: projectileObject.benchmark
} );
}

// create view for dropdown
Expand Down
22 changes: 12 additions & 10 deletions js/lab/view/LabProjectilePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,11 @@ define( require => {
const comboBoxItems = [];
for ( let i = 0; i < this.objectTypes.length; i++ ) {
const projectileObject = this.objectTypes[ i ];
comboBoxItems[ i ] = new ComboBoxItem( new Text( projectileObject.name, itemNodeOptions ), projectileObject, {
tandemName: projectileObject.benchmark
} );

comboBoxItems[ i ] = new ComboBoxItem( i === 0 ? firstItemNode : new Text( projectileObject.name, itemNodeOptions ),
projectileObject, {
tandemName: projectileObject.benchmark
} );

// Create the controls for tht objectType too.
this.objectTypeControls.push( this.createControlsForObjectType( projectileObject, tandem, tandem.createTandem( `${projectileObject.benchmark}Control` ) ) );
Expand Down Expand Up @@ -167,19 +169,19 @@ define( require => {

// air resistance
const airResistanceLabel = new Text( airResistanceString, LABEL_OPTIONS );
const airResistanceCheckbox = new Checkbox( airResistanceLabel, model.airResistanceOnProperty, {
const airResistanceLabelAndIcon = new HBox( {
spacing: options.xMargin,
children: [ airResistanceLabel, new Node( { children: [ AIR_RESISTANCE_ICON ] } ) ]
} );
const airResistanceCheckbox = new Checkbox( airResistanceLabelAndIcon, model.airResistanceOnProperty, {
maxWidth: options.minWidth - AIR_RESISTANCE_ICON.width - 3 * options.xMargin,
boxWidth: 18,
tandem: tandem.createTandem( 'airResistanceCheckbox' )
} );
const airResistanceCheckboxAndIcon = new HBox( {
spacing: options.xMargin,
children: [ airResistanceCheckbox, AIR_RESISTANCE_ICON ]
} );

// The contents of the control panel
const content = new VBox( {
align: 'center',
align: 'left',
spacing: options.controlsVerticalSpace,
children: [
projectileChoiceComboBox,
Expand All @@ -188,7 +190,7 @@ define( require => {
new Line( 0, 0, options.minWidth - 2 * options.xMargin, 0, { stroke: 'gray' } ),
gravityBox,
new Line( 0, 0, options.minWidth - 2 * options.xMargin, 0, { stroke: 'gray' } ),
airResistanceCheckboxAndIcon,
airResistanceCheckbox,
altitudeBox,
dragCoefficientBox
]
Expand Down

0 comments on commit a22c072

Please sign in to comment.