diff --git a/js/common/view/GreenhouseEffectCheckbox.ts b/js/common/view/GreenhouseEffectCheckbox.ts index 6d9ba81e..bcc7ccdc 100644 --- a/js/common/view/GreenhouseEffectCheckbox.ts +++ b/js/common/view/GreenhouseEffectCheckbox.ts @@ -39,6 +39,7 @@ class GreenhouseEffectCheckbox extends Checkbox { const options = optionize()( { iconNode: null, maxLabelTextWidth: 180, // empirically determined, works well for most cases in Greenhouse + isDisposable: false, // i18n maxWidth: 250, diff --git a/js/common/view/ObservationWindowPDOMNode.ts b/js/common/view/ObservationWindowPDOMNode.ts index de12c75d..57e038db 100644 --- a/js/common/view/ObservationWindowPDOMNode.ts +++ b/js/common/view/ObservationWindowPDOMNode.ts @@ -25,8 +25,7 @@ class ObservationWindowPDOMNode extends Node { protected constructor( model: LayersModel ) { super( { - - // pdom + isDisposable: false, tagName: 'ul' } ); diff --git a/js/photons/PhotonsScreen.ts b/js/photons/PhotonsScreen.ts index cdd0146c..aad7a4c3 100644 --- a/js/photons/PhotonsScreen.ts +++ b/js/photons/PhotonsScreen.ts @@ -28,7 +28,8 @@ class PhotonsScreen extends Screen { tandem: tandem, name: GreenhouseEffectStrings.screen.photonsStringProperty, descriptionContent: GreenhouseEffectStrings.a11y.photons.homeScreenDescriptionStringProperty, - createKeyboardHelpNode: () => new GreenhouseEffectKeyboardHelpContent( { includeFluxMeterHelp: true } ) + createKeyboardHelpNode: () => new GreenhouseEffectKeyboardHelpContent( { includeFluxMeterHelp: true } ), + isDisposable: false }; super( diff --git a/js/waves/WavesScreen.ts b/js/waves/WavesScreen.ts index c2235435..49aefd9f 100644 --- a/js/waves/WavesScreen.ts +++ b/js/waves/WavesScreen.ts @@ -28,7 +28,8 @@ class WavesScreen extends Screen { tandem: tandem, name: GreenhouseEffectStrings.screen.wavesStringProperty, descriptionContent: GreenhouseEffectStrings.a11y.waves.homeScreenDescriptionStringProperty, - createKeyboardHelpNode: () => new GreenhouseEffectKeyboardHelpContent() + createKeyboardHelpNode: () => new GreenhouseEffectKeyboardHelpContent(), + isDisposable: false }; super( diff --git a/js/waves/model/EMWaveSource.ts b/js/waves/model/EMWaveSource.ts index f73f2573..16ae7048 100644 --- a/js/waves/model/EMWaveSource.ts +++ b/js/waves/model/EMWaveSource.ts @@ -16,6 +16,7 @@ import greenhouseEffect from '../../greenhouseEffect.js'; import Wave, { WaveCreatorArguments } from './Wave.js'; import WaveSourceSpec from './WaveSourceSpec.js'; import WithRequired from '../../../../phet-core/js/types/WithRequired.js'; +import Disposable from '../../../../axon/js/Disposable.js'; type SelfOptions = { @@ -129,6 +130,11 @@ class EMWaveSource { } ); } + + // These generally exist for the life of the sim, so disposal has not been implemented. + public dispose(): void { + Disposable.assertNotDisposable(); + } } greenhouseEffect.register( 'EMWaveSource', EMWaveSource ); diff --git a/js/waves/model/WaveAttenuator.ts b/js/waves/model/WaveAttenuator.ts index 1b205a0f..442891f8 100644 --- a/js/waves/model/WaveAttenuator.ts +++ b/js/waves/model/WaveAttenuator.ts @@ -3,6 +3,7 @@ import IOType from '../../../../tandem/js/types/IOType.js'; import NumberIO from '../../../../tandem/js/types/NumberIO.js'; import greenhouseEffect from '../../greenhouseEffect.js'; +import Disposable from '../../../../axon/js/Disposable.js'; /** * WaveAttenuator is a simple class that is used to keep track of points along a wave where attenuation (reduction in @@ -43,6 +44,12 @@ class WaveAttenuator { stateObject.distanceFromStart ) } ); + + // Instances of this class are intended to be lightweight and own no Property instances, so disposal is unneeded and + // not supported. + public dispose(): void { + Disposable.assertNotDisposable(); + } } export type WaveAttenuatorStateObject = { diff --git a/js/waves/model/WaveIntensityChange.ts b/js/waves/model/WaveIntensityChange.ts index 950ee26f..80384537 100644 --- a/js/waves/model/WaveIntensityChange.ts +++ b/js/waves/model/WaveIntensityChange.ts @@ -6,6 +6,7 @@ import NullableIO from '../../../../tandem/js/types/NullableIO.js'; import NumberIO from '../../../../tandem/js/types/NumberIO.js'; import ReferenceIO, { ReferenceIOState } from '../../../../tandem/js/types/ReferenceIO.js'; import greenhouseEffect from '../../greenhouseEffect.js'; +import Disposable from '../../../../axon/js/Disposable.js'; /** * WaveIntensityChange is a type that represents a change in a propagating wave's intensity at a point along a wave that @@ -66,6 +67,12 @@ class WaveIntensityChange { NullableIO( ReferenceIO( IOType.ObjectIO ) ).fromStateObject( stateObject.anchoredTo ) ) } ); + + // Instances of this class are intended to be lightweight and do not link to any Property instances, so disposal is + // unneeded and not supported. + public dispose(): void { + Disposable.assertNotDisposable(); + } } // for phet-io diff --git a/js/waves/model/WaveSourceSpec.ts b/js/waves/model/WaveSourceSpec.ts index d23dfcc3..c5d8fcec 100644 --- a/js/waves/model/WaveSourceSpec.ts +++ b/js/waves/model/WaveSourceSpec.ts @@ -11,6 +11,7 @@ import Vector2 from '../../../../dot/js/Vector2.js'; import greenhouseEffect from '../../greenhouseEffect.js'; +import Disposable from '../../../../axon/js/Disposable.js'; /** * A simple class that specifies the X value for where waves will be produced and a direction of travel. @@ -23,6 +24,12 @@ class WaveSourceSpec { this.xPosition = xPosition; this.propagationDirection = propagationDirection; } + + // Instances of this class are intended to be lightweight and do not link to any Property instances, so disposal is + // unneeded and not supported. + public dispose(): void { + Disposable.assertNotDisposable(); + } } greenhouseEffect.register( 'WaveSourceSpec', WaveSourceSpec ); diff --git a/js/waves/view/WavesCanvasNode.ts b/js/waves/view/WavesCanvasNode.ts index 6345540b..875ef655 100644 --- a/js/waves/view/WavesCanvasNode.ts +++ b/js/waves/view/WavesCanvasNode.ts @@ -42,8 +42,7 @@ class WavesCanvasNode extends CanvasNode { public constructor( model: WavesModel, modelViewTransform: ModelViewTransform2, providedOptions: WavesCanvasNodeOptions ) { const options = optionize()( { - - // CanvasNodeOptions + isDisposable: false, visiblePropertyOptions: { phetioFeatured: true } }, providedOptions ); @@ -118,15 +117,13 @@ class WavesCanvasNode extends CanvasNode { let nextIntensityChangePosition = this.getIntensityChangeXPosition( nextIntensityChangeIndex, wave, - amplitude, - wavelength + amplitude ); // Get the amount of compensation needed in the x direction so that the wave will appear to originate from a // horizontal region. const compensatedStartingXValue = WavesCanvasNode.getXCompensationForTilt( amplitude, - wavelength, phaseOffsetAtStart, wave.propagationDirection.getAngle() ); @@ -168,8 +165,7 @@ class WavesCanvasNode extends CanvasNode { nextIntensityChangePosition = this.getIntensityChangeXPosition( nextIntensityChangeIndex, wave, - amplitude, - wavelength + amplitude ); } } @@ -184,9 +180,8 @@ class WavesCanvasNode extends CanvasNode { * @param index - index of the intensity change of interest * @param wave - wave on which the intensity change may exist * @param amplitudeInView - * @param wavelengthInView */ - private getIntensityChangeXPosition( index: number, wave: Wave, amplitudeInView: number, wavelengthInView: number ): number { + private getIntensityChangeXPosition( index: number, wave: Wave, amplitudeInView: number ): number { const intensityChange = wave.intensityChanges[ index ]; const intensityChangeDistanceFromStart = intensityChange ? intensityChange.distanceFromStart : @@ -198,7 +193,6 @@ class WavesCanvasNode extends CanvasNode { ); xPosition += WavesCanvasNode.getXCompensationForTilt( amplitudeInView, - wavelengthInView, phaseAtNominalXPosition, wave.propagationDirection.getAngle() ); @@ -212,20 +206,18 @@ class WavesCanvasNode extends CanvasNode { * computational clipping. For more information on why this is necessary and what it does, please see * https://github.com/phetsims/greenhouse-effect/issues/66. * - * This is not an exact solution, it's an approximation that works resonably well. I (jbphet) spent a couple of hours - * trying to come up with an analytical, closed form solution, but didn't get there, and some poking around on line - * led me to believe that it's not an easy problem, so I came up with this, which seems to work well enough for the - * needs of this sim. + * This is not an exact solution, it's an approximation that works reasonably well. I (jbphet) spent a couple of + * hours trying to come up with an analytical, closed form solution, but didn't get there, and some poking around + * online led me to believe that it's not an easy problem, so I came up with this, which seems to work well enough for + * the needs of this sim. * * Note that this algorithm assumes the waves are generated by a sine function, not a cosine. * * @param amplitudeInView - * @param wavelengthInView * @param phase - in radians * @param propagationAngle - in radians, 0 is straight to the right */ private static getXCompensationForTilt( amplitudeInView: number, - wavelengthInView: number, phase: number, propagationAngle: number ): number { diff --git a/js/waves/view/WavesScreenSummaryContentNode.ts b/js/waves/view/WavesScreenSummaryContentNode.ts index 22a92caf..61920fdb 100644 --- a/js/waves/view/WavesScreenSummaryContentNode.ts +++ b/js/waves/view/WavesScreenSummaryContentNode.ts @@ -30,7 +30,7 @@ const qualitativeAndQuantitativeTemperatureDescriptionPatternStringProperty = Gr class WavesScreenSummaryContentNode extends Node { public constructor( model: WavesModel ) { - super(); + super( { isDisposable: false } ); const playAreaDescriptionNode = new Node( { tagName: 'p', diff --git a/js/waves/view/WavesScreenView.ts b/js/waves/view/WavesScreenView.ts index 6d3e34fa..5ac06a4d 100644 --- a/js/waves/view/WavesScreenView.ts +++ b/js/waves/view/WavesScreenView.ts @@ -34,8 +34,7 @@ class WavesScreenView extends GreenhouseEffectScreenView { // Create the observation window that will depict the ground, sky, light waves, etc. const observationWindow = new WaveLandscapeObservationWindow( model, { - - // phet-io + isDisposable: false, tandem: tandem.createTandem( 'observationWindow' ) } );