Skip to content

Commit

Permalink
Adding layout for Force Scaling option, see phetsims/my-solar-system#104
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinVallejo committed Mar 15, 2023
1 parent 18b1333 commit 105a645
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
6 changes: 6 additions & 0 deletions js/model/SolarSystemCommonModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ abstract class SolarSystemCommonModel<EngineType extends Engine = Engine> {
public readonly moreDataProperty: BooleanProperty;
public readonly realUnitsProperty: BooleanProperty;

public readonly forceScaleProperty: NumberProperty; // Power of 10 to which the force is scaled
public readonly zoomLevelProperty: NumberProperty;
public readonly zoomProperty: ReadOnlyProperty<number>;
public readonly isLab: boolean;
Expand Down Expand Up @@ -188,6 +189,11 @@ abstract class SolarSystemCommonModel<EngineType extends Engine = Engine> {
this.moreDataProperty = new BooleanProperty( false, { tandem: tandem.createTandem( 'moreDataProperty' ) } );
this.realUnitsProperty = new BooleanProperty( false, { tandem: tandem.createTandem( 'realUnitsProperty' ) } );


this.forceScaleProperty = new NumberProperty( 0, {
range: new Range( -2, 8 ),
numberType: 'Integer'
} );
this.zoomLevelProperty = new NumberProperty( 4, {
range: new Range( 1, 6 ),
tandem: tandem.createTandem( 'zoomLevelProperty' ),
Expand Down
29 changes: 15 additions & 14 deletions js/view/createArrowsVisibilityCheckboxes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,10 @@ const SPACING = 10;

const createArrowsVisibilityCheckboxes = ( model: SolarSystemCommonModel, tandem: Tandem ): SolarSystemCommonCheckbox[] => {
return [
// gravity force checkbox
new SolarSystemCommonCheckbox( model.gravityVisibleProperty, new HBox( combineOptions<HBoxOptions>( {
children: [
new Text( SolarSystemCommonStrings.gravityForceStringProperty, TEXT_OPTIONS ),
new ArrowNode( 135, ARROW_Y_COORDINATE, 180, ARROW_Y_COORDINATE, { fill: PhetColorScheme.GRAVITATIONAL_FORCE } )
]
}, {
spacing: SPACING
} ) ), {
accessibleName: SolarSystemCommonStrings.gravityForceStringProperty,
tandem: tandem.createTandem( 'gravityForceCheckbox' )
// speed checkbox
new SolarSystemCommonCheckbox( model.valuesVisibleProperty, new Text( SolarSystemCommonStrings.speedStringProperty, TEXT_OPTIONS ), {
accessibleName: SolarSystemCommonStrings.speedStringProperty,
tandem: tandem.createTandem( 'valuesVisibleCheckbox' )
} ),
// velocity checkbox
new SolarSystemCommonCheckbox( model.velocityVisibleProperty, new HBox( combineOptions<HBoxOptions>( {
Expand All @@ -53,9 +46,17 @@ const createArrowsVisibilityCheckboxes = ( model: SolarSystemCommonModel, tandem
accessibleName: SolarSystemCommonStrings.velocityStringProperty,
tandem: tandem.createTandem( 'velocityCheckbox' )
} ),
new SolarSystemCommonCheckbox( model.valuesVisibleProperty, new Text( SolarSystemCommonStrings.speedStringProperty, TEXT_OPTIONS ), {
accessibleName: SolarSystemCommonStrings.speedStringProperty,
tandem: tandem.createTandem( 'valuesVisibleCheckbox' )
// gravity force checkbox
new SolarSystemCommonCheckbox( model.gravityVisibleProperty, new HBox( combineOptions<HBoxOptions>( {
children: [
new Text( SolarSystemCommonStrings.gravityForceStringProperty, TEXT_OPTIONS ),
new ArrowNode( 135, ARROW_Y_COORDINATE, 180, ARROW_Y_COORDINATE, { fill: PhetColorScheme.GRAVITATIONAL_FORCE } )
]
}, {
spacing: SPACING
} ) ), {
accessibleName: SolarSystemCommonStrings.gravityForceStringProperty,
tandem: tandem.createTandem( 'gravityForceCheckbox' )
} )
];
};
Expand Down

0 comments on commit 105a645

Please sign in to comment.