From 4bf7e9438a3f3877bcf33d1aa2dcab9eec18e01a Mon Sep 17 00:00:00 2001 From: Sam Reid Date: Thu, 14 Oct 2021 15:34:58 -0600 Subject: [PATCH] Port CircuitElementViewType to string union enumeration, see https://github.com/phetsims/circuit-construction-kit-common/issues/749 --- js/model/ACVoltage.ts | 2 +- js/model/Battery.ts | 2 +- js/model/CircuitConstructionKitModel.js | 4 ++-- js/model/CircuitElementViewType.js | 17 ----------------- js/model/CircuitElementViewType.ts | 12 ++++++++++++ js/model/LightBulb.js | 5 ++--- js/model/VoltageSource.ts | 2 +- js/view/CCKCLightBulbNode.js | 3 +-- js/view/CapacitorCircuitElementNode.js | 5 ++--- js/view/ChargeNode.js | 3 +-- js/view/CircuitElementToolFactory.js | 15 +++++++-------- js/view/CircuitLayerNode.js | 3 +-- js/view/FixedCircuitElementNode.js | 3 +-- js/view/SensorToolbox.js | 3 +-- js/view/SeriesAmmeterNode.js | 3 +-- js/view/SwitchNode.js | 15 +++++++-------- js/view/ViewRadioButtonGroup.js | 9 ++++----- js/view/WireNode.js | 3 +-- 18 files changed, 46 insertions(+), 63 deletions(-) delete mode 100644 js/model/CircuitElementViewType.js create mode 100644 js/model/CircuitElementViewType.ts diff --git a/js/model/ACVoltage.ts b/js/model/ACVoltage.ts index 38b46329..520c7be8 100644 --- a/js/model/ACVoltage.ts +++ b/js/model/ACVoltage.ts @@ -49,7 +49,7 @@ class ACVoltage extends VoltageSource { range: new Range( -MAX_VOLTAGE, MAX_VOLTAGE ) } }, options ) as ACVoltageOptions; - super( startVertex, endVertex, internalResistanceProperty, CCKCConstants.BATTERY_LENGTH, tandem, options ); + super( startVertex, endVertex, internalResistanceProperty, CCKCConstants.BATTERY_LENGTH, tandem, filledOptions ); // @public {NumberProperty} - the maximum voltage, which can be controlled by the CircuitElementNumberControl this.maximumVoltageProperty = new NumberProperty( filledOptions.voltage, { diff --git a/js/model/Battery.ts b/js/model/Battery.ts index 2cb1c40b..efb92885 100644 --- a/js/model/Battery.ts +++ b/js/model/Battery.ts @@ -45,7 +45,7 @@ class Battery extends VoltageSource { range: batteryType === 'normal' ? new Range( 0, 120 ) : new Range( 100, 100000 ) } }, options ) as BatteryOptions; - super( startVertex, endVertex, internalResistanceProperty, BATTERY_LENGTH, tandem, options ); + super( startVertex, endVertex, internalResistanceProperty, BATTERY_LENGTH, tandem, filledOptions ); // @public (read-only) {string} - track which way the battery "button" (plus side) was facing the initial state so // the user can only create a certain number of "left" or "right" batteries from the toolbox. diff --git a/js/model/CircuitConstructionKitModel.js b/js/model/CircuitConstructionKitModel.js index 85c08cf8..fa82ce53 100644 --- a/js/model/CircuitConstructionKitModel.js +++ b/js/model/CircuitConstructionKitModel.js @@ -10,6 +10,7 @@ import BooleanProperty from '../../../axon/js/BooleanProperty.js'; import Emitter from '../../../axon/js/Emitter.js'; import EnumerationProperty from '../../../axon/js/EnumerationProperty.js'; +import Property from '../../../axon/js/Property.js'; import NumberProperty from '../../../axon/js/NumberProperty.js'; import Utils from '../../../dot/js/Utils.js'; import merge from '../../../phet-core/js/merge.js'; @@ -21,7 +22,6 @@ import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; import ZoomControlPanel from '../view/ZoomControlPanel.js'; import Ammeter from './Ammeter.js'; import Circuit from './Circuit.js'; -import CircuitElementViewType from './CircuitElementViewType.js'; import Voltmeter from './Voltmeter.js'; import ZoomAnimation from './ZoomAnimation.js'; @@ -45,7 +45,7 @@ class CircuitConstructionKitModel { this.zoomAnimation = null; // @public {Property.} - whether to show lifelike or schematic representations - this.viewTypeProperty = new EnumerationProperty( CircuitElementViewType, CircuitElementViewType.LIFELIKE, { + this.viewTypeProperty = new Property( 'lifelike', { tandem: tandem.createTandem( 'viewTypeProperty' ) } ); diff --git a/js/model/CircuitElementViewType.js b/js/model/CircuitElementViewType.js deleted file mode 100644 index 98907740..00000000 --- a/js/model/CircuitElementViewType.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017-2020, University of Colorado Boulder - -/** - * Enumeration for how to render the circuit elements: lifelike or schematic. - * Because of how this file is used in the model and query parameter file, it must be declared separately - * to avoid circular module loading errors. - * - * @author Sam Reid (PhET Interactive Simulations) - */ - -import Enumeration from '../../../phet-core/js/Enumeration.js'; -import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; - -const CircuitElementViewType = Enumeration.byKeys( [ 'LIFELIKE', 'SCHEMATIC' ] ); - -circuitConstructionKitCommon.register( 'CircuitElementViewType', CircuitElementViewType ); -export default CircuitElementViewType; \ No newline at end of file diff --git a/js/model/CircuitElementViewType.ts b/js/model/CircuitElementViewType.ts new file mode 100644 index 00000000..c28792f9 --- /dev/null +++ b/js/model/CircuitElementViewType.ts @@ -0,0 +1,12 @@ +// Copyright 2017-2020, University of Colorado Boulder + +/** + * Enumeration for how to render the circuit elements: lifelike or schematic. + * Because of how this file is used in the model and query parameter file, it must be declared separately + * to avoid circular module loading errors. + * + * @author Sam Reid (PhET Interactive Simulations) + */ + +type CircuitElementViewType = 'lifelike'|'schematic'; +export default CircuitElementViewType \ No newline at end of file diff --git a/js/model/LightBulb.js b/js/model/LightBulb.js index 2a9370b8..00481e9d 100644 --- a/js/model/LightBulb.js +++ b/js/model/LightBulb.js @@ -12,7 +12,6 @@ import Utils from '../../../dot/js/Utils.js'; import Vector2 from '../../../dot/js/Vector2.js'; import merge from '../../../phet-core/js/merge.js'; import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; -import CircuitElementViewType from './CircuitElementViewType.js'; import FixedCircuitElement from './FixedCircuitElement.js'; import Vertex from './Vertex.js'; @@ -109,7 +108,7 @@ class LightBulb extends FixedCircuitElement { */ getPathLength() { let pathLength = 0; - const samplePoints = this.viewTypeProperty.value === CircuitElementViewType.LIFELIKE ? LIFELIKE_SAMPLE_POINTS : SCHEMATIC_SAMPLE_POINTS; + const samplePoints = this.viewTypeProperty.value === 'lifelike' ? LIFELIKE_SAMPLE_POINTS : SCHEMATIC_SAMPLE_POINTS; let currentPoint = this.getFilamentPathPoint( 0, Vector2.ZERO, samplePoints ); for ( let i = 1; i < samplePoints.length; i++ ) { const nextPoint = this.getFilamentPathPoint( i, Vector2.ZERO, samplePoints ); @@ -183,7 +182,7 @@ class LightBulb extends FixedCircuitElement { let previousAccumulatedDistance = 0; let accumulatedDistance = 0; - const samplePoints = this.viewTypeProperty.value === CircuitElementViewType.LIFELIKE ? LIFELIKE_SAMPLE_POINTS : SCHEMATIC_SAMPLE_POINTS; + const samplePoints = this.viewTypeProperty.value === 'lifelike' ? LIFELIKE_SAMPLE_POINTS : SCHEMATIC_SAMPLE_POINTS; let currentPoint = this.getFilamentPathPoint( 0, this.startVertexProperty.get().positionProperty.get(), samplePoints ); for ( let i = 1; i < samplePoints.length; i++ ) { const nextPoint = this.getFilamentPathPoint( i, this.startVertexProperty.get().positionProperty.get(), samplePoints ); diff --git a/js/model/VoltageSource.ts b/js/model/VoltageSource.ts index 50225a81..c1651a8e 100644 --- a/js/model/VoltageSource.ts +++ b/js/model/VoltageSource.ts @@ -46,7 +46,7 @@ class VoltageSource extends FixedCircuitElement { tandem: tandem.createTandem( 'voltageProperty' ) } }, options ) as VoltageSourceOptions; - super( startVertex, endVertex, length, tandem, options ); + super( startVertex, endVertex, length, tandem, filledOptions ); // @public {NumberProperty} - the voltage of the battery in volts this.voltageProperty = new NumberProperty( filledOptions.voltage, filledOptions.voltagePropertyOptions ); diff --git a/js/view/CCKCLightBulbNode.js b/js/view/CCKCLightBulbNode.js index 37ee42a6..5f04db11 100644 --- a/js/view/CCKCLightBulbNode.js +++ b/js/view/CCKCLightBulbNode.js @@ -24,7 +24,6 @@ import lightBulbFrontRealImage from '../../images/light-bulb-front-real_png.js'; import lightBulbMiddleImage from '../../mipmaps/light-bulb-middle_png.js'; import CCKCConstants from '../CCKCConstants.js'; import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; -import CircuitElementViewType from '../model/CircuitElementViewType.js'; import CustomLightBulbNode from './CustomLightBulbNode.js'; import FixedCircuitElementNode from './FixedCircuitElementNode.js'; import LightBulbSocketNode from './LightBulbSocketNode.js'; @@ -231,7 +230,7 @@ class CCKCLightBulbNode extends FixedCircuitElementNode { options ); viewListener = view => { - this.rayNodeContainer.visible = view === CircuitElementViewType.LIFELIKE; + this.rayNodeContainer.visible = view === 'lifelike'; }; viewTypeProperty.link( viewListener ); circuitLayerNode && circuitLayerNode.lightBulbSocketLayer.addChild( this.socketNode ); diff --git a/js/view/CapacitorCircuitElementNode.js b/js/view/CapacitorCircuitElementNode.js index 285f0938..5d7d2e31 100644 --- a/js/view/CapacitorCircuitElementNode.js +++ b/js/view/CapacitorCircuitElementNode.js @@ -25,7 +25,6 @@ import Tandem from '../../../tandem/js/Tandem.js'; import wireIconImage from '../../images/wire-icon_png.js'; import CCKCConstants from '../CCKCConstants.js'; import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; -import CircuitElementViewType from '../model/CircuitElementViewType.js'; import FixedCircuitElementNode from './FixedCircuitElementNode.js'; // constants @@ -237,7 +236,7 @@ class CapacitorCircuitElementNode extends FixedCircuitElementNode { */ frontSideContainsSensorPoint( globalPoint ) { - if ( this.viewTypeProperty.value === CircuitElementViewType.LIFELIKE ) { + if ( this.viewTypeProperty.value === 'lifelike' ) { return this.capacitorCircuitElementLifelikeNode.frontSideContainsSensorPoint( globalPoint ) || this.leftWireStub.containsPoint( this.leftWireStub.globalToParentPoint( globalPoint ) ); } @@ -254,7 +253,7 @@ class CapacitorCircuitElementNode extends FixedCircuitElementNode { */ backSideContainsSensorPoint( globalPoint ) { - if ( this.viewTypeProperty.value === CircuitElementViewType.LIFELIKE ) { + if ( this.viewTypeProperty.value === 'lifelike' ) { return this.capacitorCircuitElementLifelikeNode.backSideContainsSensorPoint( globalPoint ) || this.rightWireStub.containsPoint( this.rightWireStub.globalToParentPoint( globalPoint ) ); } diff --git a/js/view/ChargeNode.js b/js/view/ChargeNode.js index 484c4c26..6c3ea046 100644 --- a/js/view/ChargeNode.js +++ b/js/view/ChargeNode.js @@ -15,7 +15,6 @@ import Node from '../../../scenery/js/nodes/Node.js'; import Tandem from '../../../tandem/js/Tandem.js'; import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; import Capacitor from '../model/Capacitor.js'; -import CircuitElementViewType from '../model/CircuitElementViewType.js'; import ConventionalCurrentArrowNode from './ConventionalCurrentArrowNode.js'; // constants @@ -115,7 +114,7 @@ class ChargeNode extends Node { // For unknown reasons, the x and y coordinates are swapped here. The values were determined empirically. let globalClipShape = null; - const isLifelike = this.circuitLayerNode.model.viewTypeProperty.value === CircuitElementViewType.LIFELIKE; + const isLifelike = this.circuitLayerNode.model.viewTypeProperty.value === 'lifelike'; if ( isLifelike ) { // For the lifelike view, we clip based on the pseudo-3d effect, so the charges come from "behind" the edge diff --git a/js/view/CircuitElementToolFactory.js b/js/view/CircuitElementToolFactory.js index c6f1fe56..d7339641 100644 --- a/js/view/CircuitElementToolFactory.js +++ b/js/view/CircuitElementToolFactory.js @@ -26,7 +26,6 @@ import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; import ACVoltage from '../model/ACVoltage.js'; import Battery from '../model/Battery.js'; import Capacitor from '../model/Capacitor.js'; -import CircuitElementViewType from '../model/CircuitElementViewType.js'; import Fuse from '../model/Fuse.js'; import Inductor from '../model/Inductor.js'; import LightBulb from '../model/LightBulb.js'; @@ -70,8 +69,8 @@ const SWITCH_LENGTH = CCKCConstants.SWITCH_LENGTH; // Separate icons are made for schematic/lifelike so they can be aligned const iconAlignGroup = new AlignGroup(); -const LIFELIKE_PROPERTY = new Property( CircuitElementViewType.LIFELIKE ); -const SCHEMATIC_PROPERTY = new Property( CircuitElementViewType.SCHEMATIC ); +const LIFELIKE_PROPERTY = new Property( 'lifelike' ); +const SCHEMATIC_PROPERTY = new Property( 'schematic' ); class CircuitElementToolFactory { @@ -155,13 +154,13 @@ class CircuitElementToolFactory { const schematicIcon = wrap( createIcon( options.tandem.createTandem( 'schematicIcon' ), SCHEMATIC_PROPERTY ), options.schematicIconHeight ); const toggleNode = new ToggleNode( this.viewTypeProperty, [ - { value: CircuitElementViewType.LIFELIKE, node: lifelikeIcon }, - { value: CircuitElementViewType.SCHEMATIC, node: schematicIcon } + { value: 'lifelike', node: lifelikeIcon }, + { value: 'schematic', node: schematicIcon } ] ); this.viewTypeProperty.link( viewType => { - lifelikeIcon.visible = viewType === CircuitElementViewType.LIFELIKE; - schematicIcon.visible = viewType === CircuitElementViewType.SCHEMATIC; + lifelikeIcon.visible = viewType === 'lifelike'; + schematicIcon.visible = viewType === 'schematic'; } ); return new CircuitElementToolNode( @@ -190,7 +189,7 @@ class CircuitElementToolFactory { // Cache a single instance to simplify PhET-iO this.wireToolNode = this.createCircuitElementToolNode( wireString, CCKCConstants.NUMBER_OF_WIRES, ( tandem, viewTypeProperty ) => { - return viewTypeProperty.value === CircuitElementViewType.LIFELIKE ? new Image( wireIconImage, { + return viewTypeProperty.value === 'lifelike' ? new Image( wireIconImage, { tandem: tandem } ) : new Line( 0, 0, 120, 0, { stroke: Color.BLACK, diff --git a/js/view/CircuitLayerNode.js b/js/view/CircuitLayerNode.js index 99b1462c..c8564eec 100644 --- a/js/view/CircuitLayerNode.js +++ b/js/view/CircuitLayerNode.js @@ -32,7 +32,6 @@ import ACVoltage from '../model/ACVoltage.js'; import Battery from '../model/Battery.js'; import Capacitor from '../model/Capacitor.js'; import CurrentSense from '../model/CurrentSense.js'; -import CircuitElementViewType from '../model/CircuitElementViewType.js'; import Dog from '../model/Dog.js'; import FixedCircuitElement from '../model/FixedCircuitElement.js'; import Fuse from '../model/Fuse.js'; @@ -228,7 +227,7 @@ class CircuitLayerNode extends Node { // choose layering for schematic vs lifelike. HEADS UP, this means circuitLayerNode.addChild() will get overwritten // so all nodes must be added as children in the array above. screenView.model.viewTypeProperty.link( view => { - this.children = ( view === CircuitElementViewType.LIFELIKE ) ? lifelikeLayering : schematicLayering; + this.children = ( view === 'lifelike' ) ? lifelikeLayering : schematicLayering; } ); // @public {Property.} the visible bounds in the coordinate frame of the circuit. Initialized with a diff --git a/js/view/FixedCircuitElementNode.js b/js/view/FixedCircuitElementNode.js index 6fd81bb9..45507964 100644 --- a/js/view/FixedCircuitElementNode.js +++ b/js/view/FixedCircuitElementNode.js @@ -16,7 +16,6 @@ import Node from '../../../scenery/js/nodes/Node.js'; import fireImage from '../../images/fire_png.js'; import CCKCUtils from '../CCKCUtils.js'; import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; -import CircuitElementViewType from '../model/CircuitElementViewType.js'; import Resistor from '../model/Resistor.js'; import CircuitElementNode from './CircuitElementNode.js'; import CircuitLayerNodeDragListener from './CircuitLayerNodeDragListener.js'; @@ -193,7 +192,7 @@ class FixedCircuitElementNode extends CircuitElementNode { * @private */ setViewType( viewType ) { - this.contentNode.children = [ viewType === CircuitElementViewType.LIFELIKE ? this.lifelikeNode : this.schematicNode ]; + this.contentNode.children = [ viewType === 'lifelike' ? this.lifelikeNode : this.schematicNode ]; // Update the dimensions of the highlight. For Switches, retain the original bounds (big enough to encapsulate // both schematic and lifelike open and closed). diff --git a/js/view/SensorToolbox.js b/js/view/SensorToolbox.js index fc6f2c2d..ac3c6579 100644 --- a/js/view/SensorToolbox.js +++ b/js/view/SensorToolbox.js @@ -26,7 +26,6 @@ import CCKCConstants from '../CCKCConstants.js'; import circuitConstructionKitCommonStrings from '../circuitConstructionKitCommonStrings.js'; import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; import Ammeter from '../model/Ammeter.js'; -import CircuitElementViewType from '../model/CircuitElementViewType.js'; import SeriesAmmeter from '../model/SeriesAmmeter.js'; import Vertex from '../model/Vertex.js'; import Voltmeter from '../model/Voltmeter.js'; @@ -138,7 +137,7 @@ class SensorToolbox extends CCKCPanel { const seriesAmmeterToolNode = new CircuitElementToolNode( '', new BooleanProperty( false ), - new Property( CircuitElementViewType.SCHEMATIC ), + new Property( 'schematic' ), circuit, point => circuitLayerNode.globalToLocalPoint( point ), seriesAmmeterNodeIcon, diff --git a/js/view/SeriesAmmeterNode.js b/js/view/SeriesAmmeterNode.js index b2b1e15f..dbd93c4f 100644 --- a/js/view/SeriesAmmeterNode.js +++ b/js/view/SeriesAmmeterNode.js @@ -17,7 +17,6 @@ import CCKCConstants from '../CCKCConstants.js'; import CCKCUtils from '../CCKCUtils.js'; import circuitConstructionKitCommonStrings from '../circuitConstructionKitCommonStrings.js'; import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; -import CircuitElementViewType from '../model/CircuitElementViewType.js'; import FixedCircuitElementNode from './FixedCircuitElementNode.js'; const currentString = circuitConstructionKitCommonStrings.current; @@ -158,7 +157,7 @@ class SeriesAmmeterNode extends FixedCircuitElementNode { screenView, circuitLayerNode, seriesAmmeter, - new Property( CircuitElementViewType.LIFELIKE ), + new Property( 'lifelike' ), lifelikeNode, new Node( { children: [ lifelikeNode ] } ), // reuse lifelike view for the schematic view tandem, diff --git a/js/view/SwitchNode.js b/js/view/SwitchNode.js index ddca1c57..f0ca38fe 100644 --- a/js/view/SwitchNode.js +++ b/js/view/SwitchNode.js @@ -16,7 +16,6 @@ import Color from '../../../scenery/js/util/Color.js'; import LinearGradient from '../../../scenery/js/util/LinearGradient.js'; import CCKCConstants from '../CCKCConstants.js'; import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; -import CircuitElementViewType from '../model/CircuitElementViewType.js'; import FixedCircuitElementNode from './FixedCircuitElementNode.js'; // constants @@ -70,7 +69,7 @@ const createNode = function( viewType, fill, thickness, curveDiameter, closed ) x: SWITCH_LENGTH * SWITCH_START, fill: fill, stroke: Color.BLACK, - lineWidth: viewType === CircuitElementViewType.SCHEMATIC ? 0 : 1, + lineWidth: viewType === 'schematic' ? 0 : 1, pickable: true // This is necessary because we use scenery hit testing for the probe hit testing } ); @@ -105,7 +104,7 @@ const createNode = function( viewType, fill, thickness, curveDiameter, closed ) children: [ leftSegmentNode, rotatingSegmentNode, rightSegmentNode, lifelikeHinge ] } ); - if ( viewType === CircuitElementViewType.SCHEMATIC ) { + if ( viewType === 'schematic' ) { node.addChild( new Circle( thickness * 0.6, { fill: Color.BLACK, stroke: Color.BLACK, @@ -123,21 +122,21 @@ const createNode = function( viewType, fill, thickness, curveDiameter, closed ) // Create all of the images const lifelikeOpenNode = createNode( - CircuitElementViewType.LIFELIKE, lifelikeGradient, LIFELIKE_DIAMETER, 6, false + 'lifelike', lifelikeGradient, LIFELIKE_DIAMETER, 6, false ); const lifelikeOpenImage = lifelikeOpenNode.rasterized( { wrap: false } ); const lifelikeClosedNode = createNode( - CircuitElementViewType.LIFELIKE, lifelikeGradient, LIFELIKE_DIAMETER, 6, true + 'lifelike', lifelikeGradient, LIFELIKE_DIAMETER, 6, true ); const lifelikeClosedImage = lifelikeClosedNode.rasterized( { wrap: false } ); const schematicOpenImage = createNode( - CircuitElementViewType.SCHEMATIC, Color.BLACK, CCKCConstants.SCHEMATIC_LINE_WIDTH, 0, false + 'schematic', Color.BLACK, CCKCConstants.SCHEMATIC_LINE_WIDTH, 0, false ).rasterized( { wrap: false } ); const schematicClosedImage = createNode( - CircuitElementViewType.SCHEMATIC, Color.BLACK, CCKCConstants.SCHEMATIC_LINE_WIDTH, 0, true + 'schematic', Color.BLACK, CCKCConstants.SCHEMATIC_LINE_WIDTH, 0, true ).rasterized( { wrap: false } ); class SwitchNode extends FixedCircuitElementNode { @@ -200,7 +199,7 @@ class SwitchNode extends FixedCircuitElementNode { // @private {Node} - For hit testing this.lifelikeOpenNode = createNode( - CircuitElementViewType.LIFELIKE, lifelikeGradient, LIFELIKE_DIAMETER, 6, false + 'lifelike', lifelikeGradient, LIFELIKE_DIAMETER, 6, false ); // @private {function} - clean up resources when no longer used. diff --git a/js/view/ViewRadioButtonGroup.js b/js/view/ViewRadioButtonGroup.js index ac742060..cf73da87 100644 --- a/js/view/ViewRadioButtonGroup.js +++ b/js/view/ViewRadioButtonGroup.js @@ -16,7 +16,6 @@ import Tandem from '../../../tandem/js/Tandem.js'; import CCKCConstants from '../CCKCConstants.js'; import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; import Battery from '../model/Battery.js'; -import CircuitElementViewType from '../model/CircuitElementViewType.js'; import Vertex from '../model/Vertex.js'; import BatteryNode from './BatteryNode.js'; @@ -65,14 +64,14 @@ class ViewRadioButtonGroup extends RectangularRadioButtonGroup { isIcon: true, scale: SCALE } ); - const lifelikeIcon = createBatteryNode( CircuitElementViewType.LIFELIKE, tandem.createTandem( 'lifelikeIcon' ) ); - const schematicIcon = createBatteryNode( CircuitElementViewType.SCHEMATIC, tandem.createTandem( 'schematicIcon' ) ); + const lifelikeIcon = createBatteryNode( 'lifelike', tandem.createTandem( 'lifelikeIcon' ) ); + const schematicIcon = createBatteryNode( 'schematic', tandem.createTandem( 'schematicIcon' ) ); super( viewTypeProperty, [ { - value: CircuitElementViewType.LIFELIKE, + value: 'lifelike', node: lifelikeIcon, tandemName: 'lifelikeRadioButton' }, { - value: CircuitElementViewType.SCHEMATIC, + value: 'schematic', node: schematicIcon, tandemName: 'schematicRadioButton' } ], options ); diff --git a/js/view/WireNode.js b/js/view/WireNode.js index dcda318a..25ad66f6 100644 --- a/js/view/WireNode.js +++ b/js/view/WireNode.js @@ -18,7 +18,6 @@ import Color from '../../../scenery/js/util/Color.js'; import LinearGradient from '../../../scenery/js/util/LinearGradient.js'; import CCKCConstants from '../CCKCConstants.js'; import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js'; -import CircuitElementViewType from '../model/CircuitElementViewType.js'; import CircuitElementNode from './CircuitElementNode.js'; import CircuitLayerNodeDragListener from './CircuitLayerNodeDragListener.js'; @@ -336,7 +335,7 @@ class WireNode extends CircuitElementNode { */ updateRender() { const view = this.viewTypeProperty.value; - if ( view === CircuitElementViewType.LIFELIKE ) { + if ( view === 'lifelike' ) { // determine whether to use the forward or reverse gradient based on the angle const startPoint = this.wire.startPositionProperty.get();