Closed jessegreenberg closed 2 years ago
This was simple enough, the change is working nicely. Tested with Dialogs and ReadingBlocks which now interrupt when closed.
This is to be reviewed as part of the set from https://github.com/phetsims/scenery/issues/1300 by @zepumph, reopening. And thank you!
This looks really nice, thanks! Instead of creating a new closure each time we speak, can you attach a bound prototype method, or even a member variable that is set once, and then have a second value like this.canAnnouncePropertyLinked:boolean
that you check instead of checking if the listener itself is null? I think that would be slightly cleaner. If you disagree that is fine too. Feel free to close.
Great idea thanks. I went with a bound method. While I was testing this I realized that after #82 we need to do this for both utterance.canAnnounceProperty
and utterance.voicingCanAnnounceProperty
so I did that as well in the above commit. I verified that it was still working and sims passed fuzzing.
@zepumph can you take a look at this again?
Looks great, thanks!
An extension and enhancement of phetsims/scenery/issues/1300, when the Utterance.canSpeakProperty becomes false it should interrupt the Announcer if it is currently being announced.