Skip to content

Commit

Permalink
Factor out includeExtremeElements, see #900
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Feb 18, 2023
1 parent 73d930b commit fc39d6a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/model/Circuit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ export default class Circuit extends PhetioObject {
tandem: tandem.createTandem( 'batteryGroup' )
} );

this.extremeBatteryGroup = ( this.includeLabElements && !this.includeACElements ) ? new PhetioGroup( ( tandem, startVertex, endVertex ) => {
const includeExtremeElements = this.includeLabElements && !this.includeACElements;
this.extremeBatteryGroup = includeExtremeElements ? new PhetioGroup( ( tandem, startVertex, endVertex ) => {
return new Battery( startVertex, endVertex, this.sourceResistanceProperty, 'high-voltage',
tandem, {
voltage: 1000,
Expand All @@ -397,7 +398,7 @@ export default class Circuit extends PhetioObject {
tandem: tandem.createTandem( 'resistorGroup' )
} );

this.extremeResistorGroup = ( this.includeLabElements && !this.includeACElements ) ? new PhetioGroup(
this.extremeResistorGroup = includeExtremeElements ? new PhetioGroup(
( tandem, startVertex, endVertex ) =>
new Resistor( startVertex, endVertex, ResistorType.EXTREME_RESISTOR, tandem ),
() => createVertices( ResistorType.EXTREME_RESISTOR.length ), {
Expand Down Expand Up @@ -429,7 +430,7 @@ export default class Circuit extends PhetioObject {
tandem: tandem.createTandem( 'seriesAmmeterGroup' )
} ) : null;

this.extremeLightBulbGroup = ( this.includeLabElements && !this.includeACElements ) ? new PhetioGroup(
this.extremeLightBulbGroup = includeExtremeElements ? new PhetioGroup(
( tandem, startVertex, endVertex ) => {
return LightBulb.createAtPosition( startVertex, endVertex, this, CCKCConstants.HIGH_RESISTANCE,
this.viewTypeProperty, tandem, {
Expand Down

0 comments on commit fc39d6a

Please sign in to comment.