From 4984c3612ede784a60ffc631edb41de1ba9a91a8 Mon Sep 17 00:00:00 2001 From: jbphet Date: Mon, 7 Aug 2023 13:44:23 -0600 Subject: [PATCH] remove unused instances and disable constructor, see https://github.com/phetsims/greenhouse-effect/issues/339 --- js/common/view/GreenhouseGasConcentrationPanel.ts | 6 +----- js/common/view/describers/RadiationDescriber.ts | 10 ++++++---- js/photons/view/PhotonsScreenView.ts | 6 +----- js/waves/view/WavesScreenView.ts | 5 ----- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/js/common/view/GreenhouseGasConcentrationPanel.ts b/js/common/view/GreenhouseGasConcentrationPanel.ts index 3f9c949d..69956660 100644 --- a/js/common/view/GreenhouseGasConcentrationPanel.ts +++ b/js/common/view/GreenhouseGasConcentrationPanel.ts @@ -31,7 +31,6 @@ import GreenhouseEffectConstants from '../GreenhouseEffectConstants.js'; import ConcentrationModel, { ConcentrationControlMode, ConcentrationDate } from '../model/ConcentrationModel.js'; import ConcentrationSliderSoundGenerator from './ConcentrationSliderSoundGenerator.js'; import ConcentrationDescriber from './describers/ConcentrationDescriber.js'; -import RadiationDescriber from './describers/RadiationDescriber.js'; import PickRequired from '../../../../phet-core/js/types/PickRequired.js'; // constants @@ -97,12 +96,10 @@ class GreenhouseGasConcentrationPanel extends Panel { /** * @param width - overall width of the panel * @param concentrationModel - * @param radiationDescriber * @param [providedOptions] */ public constructor( width: number, concentrationModel: ConcentrationModel, - radiationDescriber: RadiationDescriber, providedOptions?: GreenhouseGasConcentrationPanelOptions ) { const options = optionize()( { @@ -132,7 +129,6 @@ class GreenhouseGasConcentrationPanel extends Panel { // controls the concentration directly by value const concentrationControl = new ConcentrationControl( concentrationModel, - radiationDescriber, options.tandem.createTandem( 'concentrationControl' ) ); @@ -363,7 +359,7 @@ class DateControl extends HBox { * Inner class representing a labeled vertical slider that directly controls greenhouse gas concentration. */ class ConcentrationControl extends VBox { - public constructor( concentrationModel: ConcentrationModel, radiationDescriber: RadiationDescriber, tandem: Tandem ) { + public constructor( concentrationModel: ConcentrationModel, tandem: Tandem ) { const sliderRange = concentrationModel.manuallyControlledConcentrationProperty.range; const sliderSoundGenerator = new ConcentrationSliderSoundGenerator( diff --git a/js/common/view/describers/RadiationDescriber.ts b/js/common/view/describers/RadiationDescriber.ts index cbba78a4..7c7439fe 100644 --- a/js/common/view/describers/RadiationDescriber.ts +++ b/js/common/view/describers/RadiationDescriber.ts @@ -9,7 +9,6 @@ import StringUtils from '../../../../../phetcommon/js/util/StringUtils.js'; import greenhouseEffect from '../../../greenhouseEffect.js'; import GreenhouseEffectStrings from '../../../GreenhouseEffectStrings.js'; import GroundLayer from '../../model/GroundLayer.js'; -import LayersModel from '../../model/LayersModel.js'; import TemperatureDescriber from './TemperatureDescriber.js'; import { ConcentrationControlMode, ConcentrationDate } from '../../model/ConcentrationModel.js'; import ConcentrationDescriber from './ConcentrationDescriber.js'; @@ -20,10 +19,13 @@ const sunlightStartedStringProperty = GreenhouseEffectStrings.a11y.sunlightStart const sunlightStartedSimPausedStringProperty = GreenhouseEffectStrings.a11y.sunlightStartedSimPausedStringProperty; class RadiationDescriber { - private readonly model: LayersModel; - public constructor( model: LayersModel ) { - this.model = model; + public constructor() { + + // At the time of this writing (Aug 2023), there are only static usages of this type, so the constructor has been + // disallowed. If state is ever needed, feel free to change this. See + // https://github.com/phetsims/greenhouse-effect/issues/339. + assert && assert( false, 'Intended, at least originally, to only be used statically.' ); } /** diff --git a/js/photons/view/PhotonsScreenView.ts b/js/photons/view/PhotonsScreenView.ts index 88aed6d7..f30a79fb 100644 --- a/js/photons/view/PhotonsScreenView.ts +++ b/js/photons/view/PhotonsScreenView.ts @@ -10,7 +10,6 @@ import { VBox } from '../../../../scenery/js/imports.js'; import Tandem from '../../../../tandem/js/Tandem.js'; import GreenhouseEffectConstants from '../../common/GreenhouseEffectConstants.js'; import GreenhouseGasConcentrationPanel from '../../common/view/GreenhouseGasConcentrationPanel.js'; -import RadiationDescriber from '../../common/view/describers/RadiationDescriber.js'; import GreenhouseEffectScreenView from '../../common/view/GreenhouseEffectScreenView.js'; import LayersModelTimeControlNode from '../../common/view/LayersModelTimeControlNode.js'; import MorePhotonsCheckbox from '../../common/view/MorePhotonsCheckbox.js'; @@ -55,13 +54,10 @@ class PhotonsScreenView extends GreenhouseEffectScreenView { tandem.createTandem( 'morePhotonsCheckbox' ) ); - // Responsible for generating descriptions about the changing radiation. - const radiationDescriber = new RadiationDescriber( model ); - const greenhouseGasConcentrationPanel = new GreenhouseGasConcentrationPanel( this.energyLegend.width, model, - radiationDescriber, { + { includeCompositionData: true, // phet-io diff --git a/js/waves/view/WavesScreenView.ts b/js/waves/view/WavesScreenView.ts index b2039f64..7e631089 100644 --- a/js/waves/view/WavesScreenView.ts +++ b/js/waves/view/WavesScreenView.ts @@ -12,7 +12,6 @@ import soundManager from '../../../../tambo/js/soundManager.js'; import Tandem from '../../../../tandem/js/Tandem.js'; import GreenhouseEffectConstants from '../../common/GreenhouseEffectConstants.js'; import GreenhouseGasConcentrationPanel from '../../common/view/GreenhouseGasConcentrationPanel.js'; -import RadiationDescriber from '../../common/view/describers/RadiationDescriber.js'; import EnergyLegend from '../../common/view/EnergyLegend.js'; import GreenhouseEffectScreenView from '../../common/view/GreenhouseEffectScreenView.js'; import LayersModelTimeControlNode from '../../common/view/LayersModelTimeControlNode.js'; @@ -88,13 +87,9 @@ class WavesScreenView extends GreenhouseEffectScreenView { model.concentrationControlModeProperty, tandem.createTandem( 'cloudCheckbox' ) ); - // Responsible for generating descriptions about the changing radiation. - const radiationDescriber = new RadiationDescriber( model ); - const greenhouseGasConcentrationPanel = new GreenhouseGasConcentrationPanel( this.energyLegend.width, model, - radiationDescriber, { // phet-io