Skip to content

Commit

Permalink
Removed redundant notes about disposal, see #191
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Nov 26, 2018
1 parent b27e1ac commit a1486b3
Show file tree
Hide file tree
Showing 14 changed files with 2 additions and 79 deletions.
2 changes: 0 additions & 2 deletions js/common/view/LightEmitterNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ define( require => {
*/
constructor( model, waveAreaNode, isPrimarySource ) {
let scene = model.lightScene;

// This exists for the lifetime of the sim and doesn't require disposal.
const laserPointerNode = new LaserPointerNode( scene.button1PressedProperty, _.extend( {
rightCenter: waveAreaNode.leftCenter.plusXY( 20, 0 )
}, DEFAULTS ) );
Expand Down
9 changes: 0 additions & 9 deletions js/common/view/SoundParticleDevPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,26 @@ define( require => {
children: [

// TODO: delete or keep? Fine tuning and discussion in https://github.com/phetsims/wave-interference/issues/142
// This exists for the lifetime of the sim and doesn't require disposal.
new NumberControl( 'cutoff',
WaveInterferenceConstants.CUTOFF,
new Range( 0, 1 ),
_.extend( { delta: 0.01, decimalPlaces: 2 }, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS )
),

// This exists for the lifetime of the sim and doesn't require disposal.
new NumberControl( 'randomness',
WaveInterferenceConstants.SOUND_PARTICLE_RANDOMNESS_PROPERTY,
new Range( 0, 30 ),
_.extend( { delta: 0.25, decimalPlaces: 2 }, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS )
),

// This exists for the lifetime of the sim and doesn't require disposal.
new NumberControl( 'ADJUST home force',
WaveInterferenceConstants.SOUND_PARTICLE_RESTORATION_SCALE,
new Range( 0.1, 2 ),
_.extend( { delta: 0.01, decimalPlaces: 2 }, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS )
),

// This exists for the lifetime of the sim and doesn't require disposal.
new NumberControl( 'friction (1=none)',
WaveInterferenceConstants.SOUND_PARTICLE_FRICTION_SCALE_PROPERTY,
new Range( 0.7, 1.0 ),
_.extend( { delta: 0.005, decimalPlaces: 3 }, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS )
),

// This exists for the lifetime of the sim and doesn't require disposal.
new NumberControl( 'ADJUST gradient force',
WaveInterferenceConstants.SOUND_PARTICLE_GRADIENT_FORCE_SCALE_PROPERTY,
new Range( 0.1, 2 ),
Expand Down
2 changes: 0 additions & 2 deletions js/common/view/TimeControlPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ define( require => {
*/
constructor( model, options ) {

// This exists for the lifetime of the sim and doesn't require disposal.
const playPauseButton = new PlayPauseButton( model.isRunningProperty, {
scale: BUTTON_SCALE
} );

// This exists for the lifetime of the sim and doesn't require disposal.
const radioButtonGroup = new WaveInterferenceVerticalAquaRadioButtonGroup( [ {
node: new WaveInterferenceText( normalString ),
value: PlaySpeedEnum.NORMAL,
Expand Down
1 change: 0 additions & 1 deletion js/common/view/WaterEmitterNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ define( require => {
*/
constructor( model, waveAreaNode, isPrimarySource ) {

// This exists for the lifetime of the sim and doesn't require disposal.
const faucetNode = new FaucetNode(
// This value is irrelevant because we use our own faucet water emitting model, but must be nonzero
// to prevent a divide by zero problem
Expand Down
7 changes: 1 addition & 6 deletions js/common/view/WaveInterferenceControlPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,10 @@ define( require => {
const amplitudeSliderContainer = new SceneToggleNode( model, scene => {

// For water scene, control the desiredAmplitude (which determines the size of the water drops)
// For other scenes, control the amplitude directly. This exists for the lifetime of the sim and doesn't require disposal.
// For other scenes, control the amplitude directly.
return new WaveInterferenceSlider( scene.desiredAmplitudeProperty || scene.amplitudeProperty, scene.amplitudeProperty.range.min, scene.amplitudeProperty.range.max );
} );

// This exists for the lifetime of the sim and doesn't require disposal.
const viewSelectionRadioButtonGroup = new VerticalAquaRadioButtonGroup( [ {
node: new WaveInterferenceText( wavesString ),
value: SoundViewType.WAVES,
Expand All @@ -124,13 +123,10 @@ define( require => {
}
} );

// This exists for the lifetime of the sim and doesn't require disposal.
const graphCheckbox = new Checkbox( new WaveInterferenceText( graphString ), model.showGraphProperty, CHECKBOX_OPTIONS );

// This exists for the lifetime of the sim and doesn't require disposal.
const screenCheckbox = new Checkbox( new WaveInterferenceText( screenString ), model.showScreenProperty, CHECKBOX_OPTIONS );

// This exists for the lifetime of the sim and doesn't require disposal.
const intensityCheckbox = new Checkbox( new WaveInterferenceText( intensityString ), model.showIntensityGraphProperty, CHECKBOX_OPTIONS );

// Only enable the intensity checkbox when the screen is selected
Expand All @@ -149,7 +145,6 @@ define( require => {
// Create faucet icon, and rasterize to clip out invisible parts (like the ShooterNode)
const sceneIcons = new WaveInterferenceSceneIcons();

// This exists for the lifetime of the sim and doesn't require disposal.
const sceneRadioButtons = new RadioButtonGroup( model.sceneProperty, [
{ value: model.waterScene, node: sceneIcons.faucetIcon },
{ value: model.soundScene, node: sceneIcons.speakerIcon },
Expand Down
2 changes: 0 additions & 2 deletions js/common/view/WaveInterferenceSceneIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ define( require => {
constructor() {

// @public - Faucet icon, and rasterize to clip out invisible parts (like the ShooterNode)
// This exists for the lifetime of the sim and doesn't require disposal.
this.faucetIcon = new FaucetNode( 1, new Property( 0 ), new Property( true ), {
interactiveProperty: new Property( false )
} ).rasterized();
Expand All @@ -31,7 +30,6 @@ define( require => {
this.speakerIcon = new Image( speakerImage );

// @public - Laser Pointer icon
// This exists for the lifetime of the sim and doesn't require disposal.
this.laserPointerIcon = new LaserPointerNode( new BooleanProperty( false ), LightEmitterNode.DEFAULT_OPTIONS );

// Uniform sizing.
Expand Down
5 changes: 0 additions & 5 deletions js/common/view/WaveMeterNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ define( require => {
model.rotationAmountProperty.link( snapToCenter );

// Add the wire behind the probe.
// This exists for the lifetime of the sim and doesn't require disposal.
this.addChild( new WireNode( connectionProperty, new Property( new Vector2( -NORMAL_DISTANCE, 0 ) ),
new NodeProperty( probeNode, 'bounds', 'centerBottom' ), new Property( new Vector2( 0, NORMAL_DISTANCE ) ), {
lineWidth: WIRE_LINE_WIDTH,
Expand Down Expand Up @@ -177,10 +176,7 @@ define( require => {
return dynamicSeries;
};

// This exists for the lifetime of the sim and doesn't require disposal.
const aboveBottomLeft1 = new DerivedProperty( [ leftBottomProperty ], position => position.isFinite() ? position.plusXY( 0, -20 ) : Vector2.ZERO );

// This exists for the lifetime of the sim and doesn't require disposal.
const aboveBottomLeft2 = new DerivedProperty( [ leftBottomProperty ], position => position.isFinite() ? position.plusXY( 0, -10 ) : Vector2.ZERO );
const series1 = initializeSeries( SERIES_1_COLOR, WIRE_1_COLOR, 5, 10, aboveBottomLeft1 );
const series2 = initializeSeries( SERIES_2_COLOR, WIRE_2_COLOR, 36, 54, aboveBottomLeft2 );
Expand All @@ -204,7 +200,6 @@ define( require => {
} );

const scrollingChartNode = new LabeledScrollingChartNode(
// This exists for the lifetime of the sim and doesn't require disposal.
new ScrollingChartNode( timeProperty, [ series1, series2 ], {
width: 150,
height: 110
Expand Down
14 changes: 0 additions & 14 deletions js/diffraction/view/DiffractionScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ define( require => {
// @private
this.model = model;

// This exists for the lifetime of the sim and doesn't require disposal.
const laserPointerNode = new LaserPointerNode( model.onProperty, {
left: 10,
centerY: 50,
Expand All @@ -75,7 +74,6 @@ define( require => {
node: new Circle( 10, { fill: 'black' } )
} ];

// This exists for the lifetime of the sim and doesn't require disposal.
const radioButtonGroup = new RadioButtonGroup( model.sceneProperty, toggleButtonsContent, {
left: 10,
bottom: this.layoutBounds.bottom - 10
Expand Down Expand Up @@ -133,13 +131,9 @@ define( require => {
this.squareControlPanel = new Panel( new VBox( {
spacing: BOX_SPACING,
children: [

// This exists for the lifetime of the sim and doesn't require disposal.
new NumberControl( 'width', model.squareWidthProperty, new Range( 2, 30 ), _.extend( {
delta: 2 // avoid odd/even artifacts
}, NUMBER_CONTROL_OPTIONS ) ),

// This exists for the lifetime of the sim and doesn't require disposal.
new NumberControl( 'height', model.squareHeightProperty, new Range( 2, 30 ), _.extend( {
delta: 2 // avoid odd/even artifacts
}, NUMBER_CONTROL_OPTIONS ) ) ]
Expand All @@ -151,11 +145,7 @@ define( require => {
this.gaussianControlPanel = new Panel( new VBox( {
spacing: BOX_SPACING,
children: [

// This exists for the lifetime of the sim and doesn't require disposal.
new NumberControl( 'sigmaX', model.sigmaXProperty, new Range( 2, 10 ), NUMBER_CONTROL_OPTIONS ),

// This exists for the lifetime of the sim and doesn't require disposal.
new NumberControl( 'sigmaY', model.sigmaYProperty, new Range( 2, 10 ), NUMBER_CONTROL_OPTIONS )
]
} ), _.extend( {
Expand All @@ -166,11 +156,7 @@ define( require => {
this.slitsControlPanel = new Panel( new VBox( {
spacing: BOX_SPACING,
children: [

// This exists for the lifetime of the sim and doesn't require disposal.
new NumberControl( 'number of lines', model.numberOfLinesProperty, new Range( 2, 200 ), NUMBER_CONTROL_OPTIONS ),

// This exists for the lifetime of the sim and doesn't require disposal.
new NumberControl( 'angle', model.angleProperty, new Range( 0, Math.PI * 2 ), _.extend( {
delta: 0.01
}, NUMBER_CONTROL_OPTIONS ) )
Expand Down
8 changes: 0 additions & 8 deletions js/interference/view/InterferenceScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@ define( require => {
constructor( model, alignGroup ) {

const createLabelText = string => new WaveInterferenceText( string, { fontSize: 10 } );

// This exists for the lifetime of the sim and doesn't require disposal.
// TODO: use SceneToggleNode?
const toggleNode = new ToggleNode( model.sceneProperty, [ {
value: model.waterScene,

// This exists for the lifetime of the sim and doesn't require disposal.
node: new NumberControl( separationString, model.waterScene.desiredSourceSeparationProperty, new Range( 1, 5 ), _.extend( {
delta: 1,
valuePattern: cmValueString,
Expand All @@ -49,8 +45,6 @@ define( require => {
}, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS ) )
}, {
value: model.soundScene,

// This exists for the lifetime of the sim and doesn't require disposal.
node: new NumberControl( separationString, model.soundScene.sourceSeparationProperty, new Range( 100, 200 ), _.extend( {
delta: 5,
valuePattern: cmValueString,
Expand All @@ -60,8 +54,6 @@ define( require => {
}, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS ) )
}, {
value: model.lightScene,

// This exists for the lifetime of the sim and doesn't require disposal.
node: new NumberControl( separationString, model.lightScene.sourceSeparationProperty, new Range( 500, 2500 ), _.extend( {
delta: 500,
valuePattern: nmValueString,
Expand Down
2 changes: 0 additions & 2 deletions js/slits/view/BarriersNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ define( require => {

// @private - Convert from model coordinates to view coordinates
this.modelViewTransform = ModelViewTransform2.createRectangleMapping( this.scene.getWaveAreaBounds(), viewBounds );

// This exists for the lifetime of the sim and doesn't require disposal.
this.addInputListener( new DragListener( {
locationProperty: scene.barrierLocationProperty,
transform: this.modelViewTransform,
Expand Down
18 changes: 0 additions & 18 deletions js/slits/view/SlitsControlPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ define( require => {
derive: 'barrierTypeProperty',
bidirectional: true
} );

// This exists for the lifetime of the sim and doesn't require disposal.
const comboBox = new ComboBox( [
ComboBox.createItem( new WaveInterferenceText( noBarrierString ), BarrierTypeEnum.NO_BARRIER ),
ComboBox.createItem( new WaveInterferenceText( oneSlitString ), BarrierTypeEnum.ONE_SLIT ),
Expand All @@ -62,30 +60,22 @@ define( require => {
];

const waterRange = new Range( 0, 5 );

// This exists for the lifetime of the sim and doesn't require disposal.
const waterSlitWidthControl = new NumberControl( slitWidthString, model.waterScene.slitWidthProperty, waterRange, _.extend( {
valuePattern: cmValueString,
majorTicks: createTicks( waterRange )
}, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS ) );

const soundRange = new Range( 0, 100 );

// This exists for the lifetime of the sim and doesn't require disposal.
const soundSlitWidthControl = new NumberControl( slitWidthString, model.soundScene.slitWidthProperty, soundRange, _.extend( {
valuePattern: cmValueString,
majorTicks: createTicks( soundRange )
}, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS ) );

const lightRange = new Range( 0, 2000 );

// This exists for the lifetime of the sim and doesn't require disposal.
const lightSlitWidthControl = new NumberControl( slitWidthString, model.lightScene.slitWidthProperty, lightRange, _.extend( {
valuePattern: nmValueString,
majorTicks: createTicks( lightRange )
}, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS ) );

// This exists for the lifetime of the sim and doesn't require disposal.
const slitWidthControl = new ToggleNode( model.sceneProperty, [
{ value: model.waterScene, node: waterSlitWidthControl },
{ value: model.soundScene, node: soundSlitWidthControl },
Expand All @@ -99,30 +89,22 @@ define( require => {
} );

const waterSeparationRange = new Range( 0, 5 );

// This exists for the lifetime of the sim and doesn't require disposal.
const waterSeparationControl = new NumberControl( slitSeparationString, model.waterScene.slitSeparationProperty, waterSeparationRange, _.extend( {
valuePattern: cmValueString,
majorTicks: createTicks( waterSeparationRange )
}, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS ) );

const soundSeparationRange = new Range( 0, 200 );

// This exists for the lifetime of the sim and doesn't require disposal.
const soundSeparationControl = new NumberControl( slitSeparationString, model.soundScene.slitSeparationProperty, soundSeparationRange, _.extend( {
valuePattern: cmValueString,
majorTicks: createTicks( soundSeparationRange )
}, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS ) );

const lightSeparationRange = new Range( 0, 2000 );

// This exists for the lifetime of the sim and doesn't require disposal.
const lightSeparationControl = new NumberControl( slitSeparationString, model.lightScene.slitSeparationProperty, lightSeparationRange, _.extend( {
valuePattern: nmValueString,
majorTicks: createTicks( lightSeparationRange )
}, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS ) );

// This exists for the lifetime of the sim and doesn't require disposal.
const slitSeparationControl = new ToggleNode( model.sceneProperty, [
{ value: model.waterScene, node: waterSeparationControl },
{ value: model.soundScene, node: soundSeparationControl },
Expand Down
3 changes: 0 additions & 3 deletions js/slits/view/SlitsScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ define( require => {
} );

// The Slits screen has an additional control panel below the main control panel, which controls the barrier/slits
// This exists for the lifetime of the sim and doesn't require disposal.
const slitControlPanel = new SlitsControlPanel( alignGroup, model, this );

// When the alignGroup changes the size of the slitsControlPanel, readjust its positioning. Should only happen
Expand Down Expand Up @@ -70,8 +69,6 @@ define( require => {

// When enabled by a query parameter, show the theoretical interference pattern.
if ( WaveInterferenceQueryParameters.theory ) {

// This exists for the lifetime of the sim and doesn't require disposal.
this.addChild( new TheoryInterferenceOverlay( model, this.waveAreaNode.bounds, {
clipArea: Shape.bounds( this.waveAreaNode.bounds )
} ) );
Expand Down
3 changes: 1 addition & 2 deletions js/slits/view/TheoryInterferenceOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ define( require => {
}
};

// When any of the relevant physical Properties change, update the lines. This node exists for the life of the
// sim and does not need to be unlinked.
// When any of the relevant physical Properties change, update the lines.
model.barrierTypeProperty.link( updateLines );
model.sceneProperty.link( updateLines );
model.scenes.forEach( scene => {
Expand Down
5 changes: 0 additions & 5 deletions js/waves/view/WavesScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ define( require => {
*/
const toolboxContains = point => toolboxPanel.parentToGlobalBounds( toolboxPanel.bounds ).containsPoint( point );

// This exists for the lifetime of the sim and doesn't require disposal.
const measuringTapeNode = new MeasuringTapeNode( measuringTapeProperty, new BooleanProperty( true ), {

// translucent white background, same value as in Projectile Motion, see https://github.com/phetsims/projectile-motion/issues/156
Expand All @@ -234,7 +233,6 @@ define( require => {
} );
model.isMeasuringTapeInPlayAreaProperty.linkAttribute( measuringTapeNode, 'visible' );

// This exists for the lifetime of the sim and doesn't require disposal.
const timerNode = new WaveInterferenceTimerNode( model, {

// Drop in toolbox
Expand Down Expand Up @@ -319,8 +317,6 @@ define( require => {
}

if ( options.showViewRadioButtonGroup ) {

// This exists for the lifetime of the sim and doesn't require disposal.
this.addChild( new ViewRadioButtonGroup( model.viewTypeProperty, {
bottom: this.layoutBounds.bottom - MARGIN,
left: this.waveAreaNode.left + SPACING + 10
Expand Down Expand Up @@ -405,7 +401,6 @@ define( require => {

/**
* Creates a ToggleNode that shows the primary or secondary source
* This exists for the lifetime of the sim and doesn't require disposal.
* TODO: use SceneToggleNode?
* @param {boolean} isPrimarySource - true if it should show the primary source
*/
Expand Down

0 comments on commit a1486b3

Please sign in to comment.