From 4b7f70058a0e866be79869c151dba45559730435 Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Tue, 16 Apr 2024 16:12:42 -0600 Subject: [PATCH] add 'Current Speed Scale' control for electromagnet, https://github.com/phetsims/faradays-electromagnetic-lab/issues/66 --- js/common/view/FELDeveloperAccordionBox.ts | 20 +++++++++++++++---- .../ElectromagnetDeveloperAccordionBox.ts | 5 +++-- .../view/TransformerDeveloperAccordionBox.ts | 3 ++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/js/common/view/FELDeveloperAccordionBox.ts b/js/common/view/FELDeveloperAccordionBox.ts index a9abbd27..c46fde5c 100644 --- a/js/common/view/FELDeveloperAccordionBox.ts +++ b/js/common/view/FELDeveloperAccordionBox.ts @@ -27,6 +27,7 @@ import Utils from '../../../../dot/js/Utils.js'; import Dimension2 from '../../../../dot/js/Dimension2.js'; import ResetButton from '../../../../scenery-phet/js/buttons/ResetButton.js'; import PickupCoil from '../model/PickupCoil.js'; +import Electromagnet from '../model/Electromagnet.js'; // Developer controls are styled independently of controls in the UI, so that we can cram more of them in. const CONTROL_FONT_SIZE = 12; @@ -80,10 +81,6 @@ export default class FELDeveloperAccordionBox extends AccordionBox { return new FELDeveloperNumberControl( 'Field Scale:', property, 2 /* decimalPlaces */ ); } - protected static createElectromagnetShapeCheckbox( property: Property ): Checkbox { - return new FELDeveloperCheckbox( 'Electromagnet Shape', property ); - } - /** * Creates the set of controls related to the pickup coil. */ @@ -101,6 +98,21 @@ export default class FELDeveloperAccordionBox extends AccordionBox { ] } ); } + + /** + * Creates the set of controls related to the electromagnet. + */ + protected static createElectromagnetControls( electromagnet: Electromagnet ): VBox { + return new VBox( { + align: 'left', + spacing: VBOX_SPACING, + children: [ + new Text( 'Electromagnet', SUBTITLE_OPTIONS ), + new FELDeveloperNumberControl( 'Current Speed Scale:', electromagnet.coil.currentSpeedScaleProperty, 1 /* decimalPlaces */ ), + new FELDeveloperCheckbox( 'Electromagnet Shape', electromagnet.shapeVisibleProperty ) + ] + } ); + } } class FELDeveloperCheckbox extends Checkbox { diff --git a/js/electromagnet/view/ElectromagnetDeveloperAccordionBox.ts b/js/electromagnet/view/ElectromagnetDeveloperAccordionBox.ts index 12cd9ac2..8d123d67 100644 --- a/js/electromagnet/view/ElectromagnetDeveloperAccordionBox.ts +++ b/js/electromagnet/view/ElectromagnetDeveloperAccordionBox.ts @@ -8,7 +8,7 @@ */ import faradaysElectromagneticLab from '../../faradaysElectromagneticLab.js'; -import { VBox } from '../../../../scenery/js/imports.js'; +import { HSeparator, VBox } from '../../../../scenery/js/imports.js'; import FELDeveloperAccordionBox from '../../common/view/FELDeveloperAccordionBox.js'; import Electromagnet from '../../common/model/Electromagnet.js'; @@ -22,7 +22,8 @@ export default class ElectromagnetDeveloperAccordionBox extends FELDeveloperAcco spacing: 10, children: [ FELDeveloperAccordionBox.createFieldScaleControl( electromagnet.fieldScaleProperty ), - FELDeveloperAccordionBox.createElectromagnetShapeCheckbox( electromagnet.shapeVisibleProperty ) + new HSeparator(), + FELDeveloperAccordionBox.createElectromagnetControls( electromagnet ) ] } ); diff --git a/js/transformer/view/TransformerDeveloperAccordionBox.ts b/js/transformer/view/TransformerDeveloperAccordionBox.ts index f90e7965..345c753f 100644 --- a/js/transformer/view/TransformerDeveloperAccordionBox.ts +++ b/js/transformer/view/TransformerDeveloperAccordionBox.ts @@ -21,7 +21,8 @@ export default class TransformerDeveloperAccordionBox extends FELDeveloperAccord spacing: 10, children: [ FELDeveloperAccordionBox.createFieldScaleControl( transformer.electromagnet.fieldScaleProperty ), - FELDeveloperAccordionBox.createElectromagnetShapeCheckbox( transformer.electromagnet.shapeVisibleProperty ), + new HSeparator(), + FELDeveloperAccordionBox.createElectromagnetControls( transformer.electromagnet ), new HSeparator(), FELDeveloperAccordionBox.createPickupCoilControls( transformer.pickupCoil ) ]