From bdfd4e0b098e85ba1a0bfd75dfa10b74825ff90b Mon Sep 17 00:00:00 2001 From: Sam Reid Date: Tue, 10 Jan 2023 10:27:22 -0700 Subject: [PATCH] Disable the play/pause/step buttons when the sun doesn't shine, see https://github.com/phetsims/greenhouse-effect/issues/241 --- js/common/view/LayersModelTimeControlNode.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/common/view/LayersModelTimeControlNode.ts b/js/common/view/LayersModelTimeControlNode.ts index 75eb6385..c3a5fdf2 100644 --- a/js/common/view/LayersModelTimeControlNode.ts +++ b/js/common/view/LayersModelTimeControlNode.ts @@ -65,6 +65,11 @@ class LayersModelTimeControlNode extends TimeControlNode { } } } ); + + // This does not need to be disposed/unlinked since it persists for the life of the sim. + model.sunEnergySource.isShiningProperty.link( isSunShining => { + this.playPauseStepButtons.enabled = isSunShining; + } ); } }