diff --git a/js/common/model/Coil.ts b/js/common/model/Coil.ts index 27298618..067a73b7 100644 --- a/js/common/model/Coil.ts +++ b/js/common/model/Coil.ts @@ -66,6 +66,9 @@ type SelfOptions = { // Horizontal spacing between loops in the coil. Zero is tightly packed. loopSpacing?: number; + // Initial value of electronsVisibleProperty. + electronsVisible?: boolean; + // Initial value of electronSpeedScaleProperty, a developer control. electronSpeedScale?: number; }; @@ -124,6 +127,7 @@ export default class Coil extends PhetioObject { wireWidth: 16, loopSpacing: 8, electronSpeedScale: 1, + electronsVisible: true, // PhetioObjectOptions phetioState: false @@ -173,7 +177,7 @@ export default class Coil extends PhetioObject { this.loopRadiusProperty = new DerivedProperty( [ this.loopAreaProperty ], loopArea => Math.sqrt( loopArea / Math.PI ) ); - this.electronsVisibleProperty = new BooleanProperty( true, { + this.electronsVisibleProperty = new BooleanProperty( options.electronsVisible, { tandem: options.tandem.createTandem( 'electronsVisibleProperty' ), phetioFeatured: true } ); diff --git a/js/common/view/FELScreenIconFactory.ts b/js/common/view/FELScreenIconFactory.ts index 1f1849d9..e472b80d 100644 --- a/js/common/view/FELScreenIconFactory.ts +++ b/js/common/view/FELScreenIconFactory.ts @@ -125,17 +125,14 @@ const FELScreenIconFactory = { */ function createCoilNode( numberOfLoops: number, loopSpacing: number ): Node { - const currentAmplitudeProperty = new NumberProperty( 0 ); - const currentAmplitudeRange = FELConstants.CURRENT_AMPLITUDE_RANGE; - - const coil = new Coil( currentAmplitudeProperty, currentAmplitudeRange, { + const coil = new Coil( new NumberProperty( 0 ), FELConstants.CURRENT_AMPLITUDE_RANGE, { numberOfLoopsRange: new RangeWithValue( numberOfLoops, numberOfLoops, numberOfLoops ), loopSpacing: loopSpacing, maxLoopArea: 7000, loopAreaPercentRange: new RangeWithValue( 100, 100, 100 ), + electronsVisible: false, tandem: Tandem.OPT_OUT } ); - coil.electronsVisibleProperty.value = false; // We must have a subclass of FELMovable associated with a coil's background layer. This one will do. const movable = new BarMagnet( { tandem: Tandem.OPT_OUT } );