From e7b7f94974d38fc6e1969680dbeb63393fa50338 Mon Sep 17 00:00:00 2001 From: Jesse Date: Tue, 7 Jan 2025 16:08:09 -0500 Subject: [PATCH] add a VoicingCircle, for https://github.com/phetsims/trig-tour/issues/108 --- .../voicing/nodes/VoicingCircle.ts | 28 +++++++++++++++++++ js/imports.ts | 1 + 2 files changed, 29 insertions(+) create mode 100644 js/accessibility/voicing/nodes/VoicingCircle.ts diff --git a/js/accessibility/voicing/nodes/VoicingCircle.ts b/js/accessibility/voicing/nodes/VoicingCircle.ts new file mode 100644 index 000000000..daf544f32 --- /dev/null +++ b/js/accessibility/voicing/nodes/VoicingCircle.ts @@ -0,0 +1,28 @@ +// Copyright 2025, University of Colorado Boulder + +/** + * A Circle that mixes Voicing. + * + * @author Jesse Greenberg (PhET Interactive Simulations) + */ + +import { EmptySelfOptions } from '../../../../../phet-core/js/optionize.js'; +import { Circle, CircleOptions, ReadingBlockOptions, scenery, Voicing } from '../../../imports.js'; + +type SelfOptions = EmptySelfOptions; +type ParentOptions = ReadingBlockOptions & CircleOptions; +export type VoicingTextOptions = SelfOptions & ParentOptions; + +class VoicingCircle extends Voicing( Circle ) { + public constructor( radius?: number | CircleOptions, options?: CircleOptions ) { + if ( typeof radius === 'object' || radius === undefined ) { + super( options ); + } + else { + super( radius, options ); + } + } +} + +scenery.register( 'VoicingCircle', VoicingCircle ); +export default VoicingCircle; \ No newline at end of file diff --git a/js/imports.ts b/js/imports.ts index daaef4122..525b231a4 100644 --- a/js/imports.ts +++ b/js/imports.ts @@ -181,6 +181,7 @@ export { default as voicingManager } from './accessibility/voicing/voicingManage export { default as voicingUtteranceQueue } from './accessibility/voicing/voicingUtteranceQueue.js'; export { default as Voicing, isVoicing } from './accessibility/voicing/Voicing.js'; export type { VoicingOptions, VoicingNode, SpeakingOptions, TVoicing } from './accessibility/voicing/Voicing.js'; +export { default as VoicingCircle } from './accessibility/voicing/nodes/VoicingCircle.js'; export { default as ReadingBlockUtterance } from './accessibility/voicing/ReadingBlockUtterance.js'; export type { ReadingBlockUtteranceOptions } from './accessibility/voicing/ReadingBlockUtterance.js'; export { default as FocusDisplayedController } from './accessibility/FocusDisplayedController.js';