Skip to content

Commit

Permalink
only show IR description when ground above min temperature, see #374
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Nov 29, 2023
1 parent b711471 commit 22c8fe7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js/layer-model/view/LayerModelObservationWindowPDOMNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ class LayerModelObservationWindowPDOMNode extends ObservationWindowPDOMNode {
visiblePhotonsListItemNode.innerContent = visiblePhotonsDescription;
} );

// Only show the visible photon description when the sun is shining.
model.sunEnergySource.isShiningProperty.link( isSunShining => {
visiblePhotonsListItemNode.pdomVisible = isSunShining;
} );

// Create a string Property that describes the behavior of the IR photons.
const infraredPhotonsDescriptionProperty = new DerivedProperty(
[
Expand Down Expand Up @@ -149,10 +154,9 @@ class LayerModelObservationWindowPDOMNode extends ObservationWindowPDOMNode {
infraredPhotonsListItemNode.innerContent = infraredPhotonsDescription;
} );

// Some of the items are only visible in the PDOM when the sun is shining.
model.sunEnergySource.isShiningProperty.link( isSunShining => {
visiblePhotonsListItemNode.pdomVisible = isSunShining;
infraredPhotonsListItemNode.pdomVisible = isSunShining;
// Only show the infrared photon description when the surface temperature is above the minimum value.
model.surfaceTemperatureKelvinProperty.link( surfaceTemperature => {
infraredPhotonsListItemNode.pdomVisible = surfaceTemperature > model.groundLayer.minimumTemperature;
} );
}
}
Expand Down

0 comments on commit 22c8fe7

Please sign in to comment.