diff --git a/js/energylevels/view/EnergyLevelsScreenView.ts b/js/energylevels/view/EnergyLevelsScreenView.ts index 097260b5..f61f339e 100644 --- a/js/energylevels/view/EnergyLevelsScreenView.ts +++ b/js/energylevels/view/EnergyLevelsScreenView.ts @@ -36,6 +36,7 @@ import EnergyLevelsZoomedInBoxNode from './EnergyLevelsZoomedInBoxNode.js'; export default class EnergyLevelsScreenView extends ScreenView { + private readonly model: EnergyLevelsModel; private readonly zoomedInBoxNode: EnergyLevelsZoomedInBoxNode; private readonly electronEnergyLevelAccordionBox: ElectronEnergyLevelAccordionBox; @@ -236,13 +237,16 @@ export default class EnergyLevelsScreenView extends ScreenView { resetAllButton ]; + this.model = model; this.zoomedInBoxNode = zoomedInBoxNode; this.electronEnergyLevelAccordionBox = electronEnergyLevelAccordionBox; } public override step( dt: number ): void { - this.zoomedInBoxNode.step( dt ); - this.electronEnergyLevelAccordionBox.step( dt ); + if ( this.model.isPlayingProperty.value ) { + this.zoomedInBoxNode.step( dt ); + this.electronEnergyLevelAccordionBox.step( dt ); + } } } diff --git a/js/spectra/view/SpectraScreenView.ts b/js/spectra/view/SpectraScreenView.ts index 709f7257..72cb9bef 100644 --- a/js/spectra/view/SpectraScreenView.ts +++ b/js/spectra/view/SpectraScreenView.ts @@ -34,6 +34,7 @@ import SpectraZoomedInBoxNode from './SpectraZoomedInBoxNode.js'; export default class SpectraScreenView extends ScreenView { + private readonly model: SpectraModel; private readonly zoomedInBoxNode: SpectraZoomedInBoxNode; public constructor( model: SpectraModel, tandem: Tandem ) { @@ -223,11 +224,14 @@ export default class SpectraScreenView extends ScreenView { resetAllButton ]; + this.model = model; this.zoomedInBoxNode = zoomedInBoxNode; } public override step( dt: number ): void { - this.zoomedInBoxNode.step( dt ); + if ( this.model.isPlayingProperty.value ) { + this.zoomedInBoxNode.step( dt ); + } } }