-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add list item that describes IR layers, see #374
- Loading branch information
Showing
4 changed files
with
66 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
js/layer-model/view/describers/InfraredAbsorbingLayersDescriptionProperty.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2023, University of Colorado Boulder | ||
|
||
/** | ||
* InfraredAbsorbingLayersDescriptionProperty is a Property<string> that describes the current number of the IR- | ||
* absorbing layers in the atmosphere. For example, one possible value is "2 infrared absorbing layers in atmosphere". | ||
* | ||
* @author John Blanco (PhET Interactive Simulations) | ||
*/ | ||
import greenhouseEffect from '../../../greenhouseEffect.js'; | ||
import StringProperty from '../../../../../axon/js/StringProperty.js'; | ||
import Multilink from '../../../../../axon/js/Multilink.js'; | ||
import TRangedProperty from '../../../../../axon/js/TRangedProperty.js'; | ||
import GreenhouseEffectStrings from '../../../GreenhouseEffectStrings.js'; | ||
import StringUtils from '../../../../../phetcommon/js/util/StringUtils.js'; | ||
|
||
class InfraredAbsorbingLayersDescriptionProperty extends StringProperty { | ||
public constructor( numberOfActiveAtmosphereLayersProperty: TRangedProperty ) { | ||
super( '' ); | ||
|
||
// Monitor the intensity Property and update the value of the string. | ||
Multilink.multilink( [ numberOfActiveAtmosphereLayersProperty ], numberOfActiveAtmosphereLayers => { | ||
|
||
// parameter checking | ||
assert && assert( | ||
numberOfActiveAtmosphereLayers >= 0, | ||
`numberOfActiveAtmosphereLayers must be positive, got ${numberOfActiveAtmosphereLayers}` | ||
); | ||
|
||
this.value = StringUtils.fillIn( | ||
GreenhouseEffectStrings.a11y.layerModel.observationWindow.numberOfAbsorbingLayersPatternStringProperty, | ||
{ | ||
number: numberOfActiveAtmosphereLayers > 0 ? | ||
numberOfActiveAtmosphereLayers : | ||
GreenhouseEffectStrings.a11y.qualitativeAmountDescriptions.noStringProperty, // say 'no' for zero | ||
s: numberOfActiveAtmosphereLayers === 1 ? '' : 's' // use plural except for a single layer | ||
} | ||
); | ||
} | ||
); | ||
} | ||
} | ||
|
||
greenhouseEffect.register( 'InfraredAbsorbingLayersDescriptionProperty', InfraredAbsorbingLayersDescriptionProperty ); | ||
export default InfraredAbsorbingLayersDescriptionProperty; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters