From 105a645b1e8c6862d6866d286ce433cd7365c69a Mon Sep 17 00:00:00 2001 From: AgustinVallejo Date: Wed, 15 Mar 2023 11:05:24 -0500 Subject: [PATCH] Adding layout for Force Scaling option, see https://github.com/phetsims/my-solar-system/issues/104 --- js/model/SolarSystemCommonModel.ts | 6 +++++ js/view/createArrowsVisibilityCheckboxes.ts | 29 +++++++++++---------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/js/model/SolarSystemCommonModel.ts b/js/model/SolarSystemCommonModel.ts index ae73f5d..3cdfe5a 100644 --- a/js/model/SolarSystemCommonModel.ts +++ b/js/model/SolarSystemCommonModel.ts @@ -82,6 +82,7 @@ abstract class SolarSystemCommonModel { 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; public readonly isLab: boolean; @@ -188,6 +189,11 @@ abstract class SolarSystemCommonModel { 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' ), diff --git a/js/view/createArrowsVisibilityCheckboxes.ts b/js/view/createArrowsVisibilityCheckboxes.ts index e2d9467..d2ca159 100644 --- a/js/view/createArrowsVisibilityCheckboxes.ts +++ b/js/view/createArrowsVisibilityCheckboxes.ts @@ -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( { - 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( { @@ -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( { + 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' ) } ) ]; };