From 23fae3830f6036e14244f294b8856b819b09460d Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Mon, 26 Dec 2022 14:29:52 -0700 Subject: [PATCH] make EnergyCheckbox hideable via PhET-iO, https://github.com/phetsims/hookes-law/issues/69 --- js/energy/view/EnergyCheckbox.ts | 2 +- js/energy/view/EnergyVisibilityPanel.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/js/energy/view/EnergyCheckbox.ts b/js/energy/view/EnergyCheckbox.ts index 2183a2a3..0402dd93 100644 --- a/js/energy/view/EnergyCheckbox.ts +++ b/js/energy/view/EnergyCheckbox.ts @@ -19,7 +19,7 @@ import { Shape } from '../../../../kite/js/imports.js'; type SelfOptions = EmptySelfOptions; -type EnergyCheckboxOptions = SelfOptions & PickRequired; +type EnergyCheckboxOptions = SelfOptions & PickRequired; export default class EnergyCheckbox extends Checkbox { diff --git a/js/energy/view/EnergyVisibilityPanel.js b/js/energy/view/EnergyVisibilityPanel.js index 62b53c99..de1b30fd 100644 --- a/js/energy/view/EnergyVisibilityPanel.js +++ b/js/energy/view/EnergyVisibilityPanel.js @@ -8,7 +8,7 @@ import DerivedProperty from '../../../../axon/js/DerivedProperty.js'; import merge from '../../../../phet-core/js/merge.js'; -import { HBox, HSeparator, HStrut, VBox } from '../../../../scenery/js/imports.js'; +import { HSeparator, VBox } from '../../../../scenery/js/imports.js'; import Panel from '../../../../sun/js/Panel.js'; import Tandem from '../../../../tandem/js/Tandem.js'; import HookesLawColors from '../../common/HookesLawColors.js'; @@ -47,6 +47,12 @@ export default class EnergyVisibilityPanel extends Panel { tandem: options.tandem.createTandem( 'energyCheckbox' ) } ); + const energyCheckboxWrapper = new VBox( { + children: [ energyCheckbox ], + layoutOptions: { leftMargin: 25 }, // indented from check boxes + visibleProperty: energyGraphRadioButtonGroup.getButton( EnergyGraph.FORCE_PLOT ).visibleProperty + } ); + const appliedForceCheckbox = new VectorCheckbox( properties.appliedForceVectorVisibleProperty, HookesLawStrings.appliedForceStringProperty, { vectorType: 'force', @@ -81,9 +87,7 @@ export default class EnergyVisibilityPanel extends Panel { const content = new VBox( { children: [ energyGraphRadioButtonGroup, - - // "Energy" checkbox indented below energyGraphRadioButtonGroup - new HBox( { children: [ new HStrut( 25 ), energyCheckbox ] } ), + energyCheckboxWrapper, new HSeparator( HookesLawConstants.HSEPARATOR_OPTIONS ), appliedForceCheckbox, displacementCheckbox,