Skip to content

Commit

Permalink
Made TNumber nonparametric and moved range/units to NumberProperty, see
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Sep 11, 2017
1 parent bfb3313 commit d8f953b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 24 deletions.
3 changes: 2 additions & 1 deletion js/model/Ammeter.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ define( function( require ) {
// display in the view. Null means the ammeter is not on a wire.
this.currentProperty = new Property( null, {
tandem: tandem.createTandem( 'currentProperty' ),
phetioValueType: TNumber( { units: 'amperes' } )
units: 'amperes',
phetioValueType: TNumber
} );

// @public {Property.<Vector2>} - the position of the tip of the probe
Expand Down
7 changes: 2 additions & 5 deletions js/model/Circuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ define( function( require ) {
var inherit = require( 'PHET_CORE/inherit' );

// phet-io modules
var TNumber = require( 'ifphetio!PHET_IO/types/TNumber' );
var TObject = require( 'ifphetio!PHET_IO/types/TObject' );
var TString = require( 'ifphetio!PHET_IO/types/TString' );

Expand Down Expand Up @@ -68,15 +67,13 @@ define( function( require ) {
// @public {NumberProperty} - All wires share the same resistivity, which is defined by
// resistance = resistivity * length. On the Lab Screen, there is a wire resistivity control
this.wireResistivityProperty = new NumberProperty( CircuitConstructionKitCommonConstants.DEFAULT_RESISTIVITY, {
tandem: tandem.createTandem( 'wireResistivityProperty' ),
phetioValueType: TNumber()
tandem: tandem.createTandem( 'wireResistivityProperty' )
} );

// @public {NumberProperty} - All batteries share a single internal resistance value, which can be edited with
// a control on the Lab Screen
this.batteryResistanceProperty = new NumberProperty( CircuitConstructionKitCommonConstants.DEFAULT_BATTERY_RESISTANCE, {
tandem: tandem.createTandem( 'batteryResistanceProperty' ),
phetioValueType: TNumber()
tandem: tandem.createTandem( 'batteryResistanceProperty' )
} );

// @public {ObservableArray.<CircuitElement>} - The different types of CircuitElement the circuit may
Expand Down
18 changes: 8 additions & 10 deletions js/model/CircuitConstructionKitModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ define( function( require ) {

// modules
var BooleanProperty = require( 'AXON/BooleanProperty' );
var Emitter = require( 'AXON/Emitter' );
var NumberProperty = require( 'AXON/NumberProperty' );
var Property = require( 'AXON/Property' );
var circuitConstructionKitCommon = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/circuitConstructionKitCommon' );
var CircuitConstructionKitCommonQueryParameters = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/CircuitConstructionKitCommonQueryParameters' );
var Ammeter = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/model/Ammeter' );
var Circuit = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/model/Circuit' );
var CircuitElementViewType = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/model/CircuitElementViewType' );
var InteractionMode = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/model/InteractionMode' );
var Voltmeter = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/model/Voltmeter' );
var ZoomControlPanel = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/view/ZoomControlPanel' );
var Util = require( 'DOT/Util' );
var inherit = require( 'PHET_CORE/inherit' );
var Emitter = require( 'AXON/Emitter' );
var EaseAnimation = require( 'TWIXT/EaseAnimation' );
var CircuitElementViewType = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/model/CircuitElementViewType' );
var InteractionMode = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/model/InteractionMode' );

// phet-io modules
var TNumber = require( 'ifphetio!PHET_IO/types/TNumber' );
var TString = require( 'ifphetio!PHET_IO/types/TString' );

// constants
Expand Down Expand Up @@ -79,15 +79,13 @@ define( function( require ) {
} );

// @public {Property.<number>} scaling applied to the circuit node so the user can zoom out and make larger circuits
this.selectedZoomProperty = new Property( 1, {
tandem: tandem.createTandem( 'selectedZoomProperty' ),
phetioValueType: TNumber()
this.selectedZoomProperty = new NumberProperty( 1, {
tandem: tandem.createTandem( 'selectedZoomProperty' )
} );

// @public (read-only) {Property.<number>} the animated value of the zoom level
this.currentZoomProperty = new Property( this.selectedZoomProperty.get(), {
tandem: tandem.createTandem( 'currentZoomProperty' ),
phetioValueType: TNumber()
this.currentZoomProperty = new NumberProperty( this.selectedZoomProperty.get(), {
tandem: tandem.createTandem( 'currentZoomProperty' )
} );

this.selectedZoomProperty.lazyLink( function( newValue ) {
Expand Down
5 changes: 1 addition & 4 deletions js/model/Vertex.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ define( function( require ) {
var inherit = require( 'PHET_CORE/inherit' );
var Tandem = require( 'TANDEM/Tandem' );

// phet-io modules
var TNumber = require( 'ifphetio!PHET_IO/types/TNumber' );

// Index counter for debugging
var counter = 0;

Expand Down Expand Up @@ -57,7 +54,7 @@ define( function( require ) {
// @public {NumberProperty} Relative voltage of the node, determined by Circuit.solve
this.voltageProperty = new NumberProperty( 0, {
tandem: options.tandem && options.tandem.createTandem( 'voltageProperty' ),
phetioValueType: TNumber( { units: 'volts' } )
units: 'volts'
} );

// @public {BooleanProperty} - after the user taps on a vertex it becomes selected, highlighting it and showing a
Expand Down
5 changes: 1 addition & 4 deletions js/model/Voltmeter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ define( function( require ) {
var Vector2 = require( 'DOT/Vector2' );
var inherit = require( 'PHET_CORE/inherit' );

// phet-io modules
var TNumber = require( 'ifphetio!PHET_IO/types/TNumber' );

/**
* @param {Tandem} tandem
* @constructor
Expand All @@ -31,7 +28,7 @@ define( function( require ) {
// @public {Property.<number|null>} the voltage the probe is reading (in volts) or null if unconnected
this.voltageProperty = new Property( null, {
tandem: tandem.createTandem( 'voltageProperty' ),
phetioValueType: TNumber( { units: 'volts' } )
units: 'volts'
} );

// @public {Property.<Vector2>} - the position of the tip of the red probe in model=view coordinates.
Expand Down

0 comments on commit d8f953b

Please sign in to comment.