Skip to content

Commit

Permalink
Rename HIGH_RESISTANCE_RESISTOR => EXTREME_RESISTOR, see #936
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Feb 3, 2023
1 parent aa00bd6 commit 758e92c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions js/model/Circuit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ export default class Circuit {

this.extremeResistorGroup = new PhetioGroup(
( tandem, startVertex, endVertex ) =>
new Resistor( startVertex, endVertex, ResistorType.HIGH_RESISTANCE_RESISTOR, tandem ),
() => createVertices( ResistorType.HIGH_RESISTANCE_RESISTOR.length ), {
new Resistor( startVertex, endVertex, ResistorType.EXTREME_RESISTOR, tandem ),
() => createVertices( ResistorType.EXTREME_RESISTOR.length ), {
phetioType: PhetioGroup.PhetioGroupIO( Resistor.ResistorIO ),
tandem: tandem.createTandem( 'extremeResistorGroup' )
} );
Expand Down
2 changes: 1 addition & 1 deletion js/model/Resistor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default class Resistor extends FixedCircuitElement {
* Returns true if the resistance is editable. Household item resistance is not editable.
*/
public isResistanceEditable(): boolean {
return this.resistorType === ResistorType.HIGH_RESISTANCE_RESISTOR ||
return this.resistorType === ResistorType.EXTREME_RESISTOR ||
this.resistorType === ResistorType.RESISTOR;
}

Expand Down
2 changes: 1 addition & 1 deletion js/model/ResistorType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
export default class ResistorType extends EnumerationValue {

public static readonly RESISTOR = new ResistorType( 10, new Range( 0, 120 ), false, CCKCConstants.RESISTOR_LENGTH );
public static readonly HIGH_RESISTANCE_RESISTOR = new ResistorType( 1000, new Range( 100, 10000 ), false, CCKCConstants.RESISTOR_LENGTH );
public static readonly EXTREME_RESISTOR = new ResistorType( 1000, new Range( 100, 10000 ), false, CCKCConstants.RESISTOR_LENGTH );
public static readonly COIN = ResistorType.fixed( 0, true, CCKCConstants.COIN_LENGTH );
public static readonly PAPER_CLIP = ResistorType.fixed( 0, true, CCKCConstants.PAPER_CLIP_LENGTH );
public static readonly PENCIL = ResistorType.fixed( 25, false, CCKCConstants.PENCIL_LENGTH );
Expand Down
10 changes: 5 additions & 5 deletions js/view/CircuitElementEditContainerNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export default class CircuitElementEditContainerNode extends Node {
createSingletonAdapterProperty( ResistorType.RESISTOR.defaultResistance, CircuitElementType, circuit, ( c: LightBulb | Resistor ) => c.resistanceProperty,
( c: LightBulb | Resistor ) =>
( c instanceof LightBulb && !c.isExtreme ) ||
( c instanceof Resistor && c.resistorType !== ResistorType.HIGH_RESISTANCE_RESISTOR )
( c instanceof Resistor && c.resistorType !== ResistorType.EXTREME_RESISTOR )
),
ResistorType.RESISTOR.range, circuit, Resistor.RESISTANCE_DECIMAL_PLACES, {
tandem: tandem.createTandem( tandemName ),
Expand All @@ -218,12 +218,12 @@ export default class CircuitElementEditContainerNode extends Node {
} );
const createExtremeResistanceNumberControl = ( tandemName: string, CircuitElementType: GConstructor<LightBulb | Resistor> ) => new CircuitElementNumberControl( resistanceStringProperty,
StringUtils.fillIn( resistanceOhmsValuePatternStringProperty, { resistance: SunConstants.VALUE_NAMED_PLACEHOLDER } ),
createSingletonAdapterProperty( ResistorType.HIGH_RESISTANCE_RESISTOR.defaultResistance, CircuitElementType, circuit, ( c: LightBulb | Resistor ) => c.resistanceProperty,
createSingletonAdapterProperty( ResistorType.EXTREME_RESISTOR.defaultResistance, CircuitElementType, circuit, ( c: LightBulb | Resistor ) => c.resistanceProperty,
( c: LightBulb | Resistor ) =>
( c instanceof LightBulb && c.isExtreme ) ||
( c instanceof Resistor && c.resistorType === ResistorType.HIGH_RESISTANCE_RESISTOR )
( c instanceof Resistor && c.resistorType === ResistorType.EXTREME_RESISTOR )
),
ResistorType.HIGH_RESISTANCE_RESISTOR.range, circuit, Resistor.HIGH_RESISTANCE_DECIMAL_PLACES, {
ResistorType.EXTREME_RESISTOR.range, circuit, Resistor.HIGH_RESISTANCE_DECIMAL_PLACES, {
tandem: circuit.includeLabElements ? tandem.createTandem( tandemName ) : Tandem.OPT_OUT,
delta: HIGH_TWEAKER_DELTA,
sliderOptions: {
Expand Down Expand Up @@ -350,7 +350,7 @@ export default class CircuitElementEditContainerNode extends Node {
if ( selectedCircuitElement ) {

if ( selectedCircuitElement instanceof Resistor && selectedCircuitElement.isResistanceEditable() ) {
const isExtreme = selectedCircuitElement.resistorType === ResistorType.HIGH_RESISTANCE_RESISTOR;
const isExtreme = selectedCircuitElement.resistorType === ResistorType.EXTREME_RESISTOR;
editNode = new EditPanel( [
isExtreme ? extremeResistorResistanceNumberControl : resistorResistanceNumberControl,
trashButtonContainer
Expand Down
2 changes: 1 addition & 1 deletion js/view/CircuitElementToolFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ export default class CircuitElementToolFactory {
public createExtremeResistorToolNode(): CircuitElementToolNode {
return this.createResistorToolNode( this.circuit.extremeResistorGroup, {
count: 4,
resistorType: ResistorType.HIGH_RESISTANCE_RESISTOR,
resistorType: ResistorType.EXTREME_RESISTOR,
tandemName: 'extremeResistorToolNode',
labelStringProperty: resistorStringProperty
} );
Expand Down
4 changes: 2 additions & 2 deletions js/view/CircuitNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,15 @@ export default class CircuitNode extends Node {
tandem: tandem.createTandem( 'resistorNodeGroup' ),
supportsDynamicState: false
} ) );
initializeCircuitElementType( ( e: CircuitElement ) => e instanceof Resistor && e.resistorType === ResistorType.HIGH_RESISTANCE_RESISTOR, this.fixedCircuitElementLayer,
initializeCircuitElementType( ( e: CircuitElement ) => e instanceof Resistor && e.resistorType === ResistorType.EXTREME_RESISTOR, this.fixedCircuitElementLayer,
new PhetioGroup<CircuitElementNode, [ CircuitElement ]>( ( tandem: Tandem, circuitElement: CircuitElement ) =>
new ResistorNode( screenView, this, circuitElement as Resistor, this.model.viewTypeProperty, tandem ),
() => [ this.circuit.extremeResistorGroup.archetype ], {
phetioType: PhetioGroup.PhetioGroupIO( Node.NodeIO ),
tandem: tandem.createTandem( 'extremeResistorNodeGroup' ),
supportsDynamicState: false
} ) );
initializeCircuitElementType( ( e: CircuitElement ) => e instanceof Resistor && e.resistorType !== ResistorType.RESISTOR && e.resistorType !== ResistorType.HIGH_RESISTANCE_RESISTOR, this.fixedCircuitElementLayer,
initializeCircuitElementType( ( e: CircuitElement ) => e instanceof Resistor && e.resistorType !== ResistorType.RESISTOR && e.resistorType !== ResistorType.EXTREME_RESISTOR, this.fixedCircuitElementLayer,
new PhetioGroup<CircuitElementNode, [ CircuitElement ]>( ( tandem: Tandem, circuitElement: CircuitElement ) => {
if ( circuitElement instanceof Dog ) {
return new DogNode( screenView, this, circuitElement, this.model.viewTypeProperty, tandem );
Expand Down
2 changes: 1 addition & 1 deletion js/view/ResistorNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ RESISTOR_IMAGE_MAP.set( ResistorType.PAPER_CLIP, paperClip_png );
RESISTOR_IMAGE_MAP.set( ResistorType.PENCIL, pencil_png );
RESISTOR_IMAGE_MAP.set( ResistorType.ERASER, eraser_png );
RESISTOR_IMAGE_MAP.set( ResistorType.HAND, hand_png );
RESISTOR_IMAGE_MAP.set( ResistorType.HIGH_RESISTANCE_RESISTOR, resistorHigh_png );
RESISTOR_IMAGE_MAP.set( ResistorType.EXTREME_RESISTOR, resistorHigh_png );
RESISTOR_IMAGE_MAP.set( ResistorType.RESISTOR, resistor_png );
RESISTOR_IMAGE_MAP.set( ResistorType.DOG, dog_png );
RESISTOR_IMAGE_MAP.set( ResistorType.DOLLAR_BILL, dollar_png );
Expand Down

0 comments on commit 758e92c

Please sign in to comment.