From 6816875f0f2c6b99ce4ef3d9da2ca21263254ad8 Mon Sep 17 00:00:00 2001 From: Jesse Date: Wed, 28 Feb 2024 17:49:49 -0500 Subject: [PATCH] rename AccessibleNumberSpinner options, see https://github.com/phetsims/sun/issues/318 --- js/NumberPicker.ts | 6 ++-- js/accessibility/AccessibleNumberSpinner.ts | 33 +++++++++++---------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/js/NumberPicker.ts b/js/NumberPicker.ts index 48819cc0..20478953 100644 --- a/js/NumberPicker.ts +++ b/js/NumberPicker.ts @@ -17,7 +17,7 @@ import Range from '../../dot/js/Range.js'; import Utils from '../../dot/js/Utils.js'; import { Shape } from '../../kite/js/imports.js'; import InstanceRegistry from '../../phet-core/js/documentation/InstanceRegistry.js'; -import { Color, FireListener, FireListenerOptions, HighlightPath, Font, LinearGradient, Node, NodeOptions, PaintColorProperty, Path, Rectangle, SceneryConstants, SceneryEvent, TColor, Text } from '../../scenery/js/imports.js'; +import { Color, FireListener, FireListenerOptions, Font, HighlightPath, LinearGradient, Node, NodeOptions, PaintColorProperty, Path, Rectangle, SceneryConstants, SceneryEvent, TColor, Text } from '../../scenery/js/imports.js'; import AccessibleNumberSpinner, { AccessibleNumberSpinnerOptions } from '../../sun/js/accessibility/AccessibleNumberSpinner.js'; import generalBoundaryBoopSoundPlayer from '../../tambo/js/shared-sound-players/generalBoundaryBoopSoundPlayer.js'; import generalSoftClickSoundPlayer from '../../tambo/js/shared-sound-players/generalSoftClickSoundPlayer.js'; @@ -90,7 +90,7 @@ type SelfOptions = { type ParentOptions = AccessibleNumberSpinnerOptions & NodeOptions; -export type NumberPickerOptions = SelfOptions & StrictOmit; +export type NumberPickerOptions = SelfOptions & StrictOmit; // options to NumberPicker.createIcon type CreateIconOptions = { @@ -231,6 +231,8 @@ export default class NumberPicker extends AccessibleNumberSpinner( Node, 0 ) { const keyboardStep = options.incrementFunction( valueProperty.get() ) - valueProperty.get(); options.keyboardStep = keyboardStep; options.shiftKeyboardStep = keyboardStep; + options.pdomTimerDelay = options.timerDelay; + options.pdomTimerInterval = options.timerInterval; const boundsRequiredOptionKeys = _.pick( options, Node.REQUIRES_BOUNDS_OPTION_KEYS ); super( _.omit( options, Node.REQUIRES_BOUNDS_OPTION_KEYS ) ); diff --git a/js/accessibility/AccessibleNumberSpinner.ts b/js/accessibility/AccessibleNumberSpinner.ts index 45e8af78..495ca410 100644 --- a/js/accessibility/AccessibleNumberSpinner.ts +++ b/js/accessibility/AccessibleNumberSpinner.ts @@ -36,16 +36,17 @@ import AccessibleValueHandler, { AccessibleValueHandlerOptions } from './Accessi import TEmitter from '../../../axon/js/TEmitter.js'; const ACCESSIBLE_NUMBER_SPINNER_OPTIONS = [ - 'timerDelay', - 'timerInterval' + 'pdomTimerDelay', + 'pdomTimerInterval' ]; type SelfOptions = { + // start to fire continuously after pressing for this long (milliseconds) - timerDelay?: number; + pdomTimerDelay?: number; // fire continuously at this frequency (milliseconds), - timerInterval?: number; + pdomTimerInterval?: number; }; type AccessibleNumberSpinnerOptions = SelfOptions & AccessibleValueHandlerOptions; @@ -67,8 +68,8 @@ const AccessibleNumberSpinner = >( Type: Sup protected readonly pdomIncrementDownEmitter: TEmitter<[ boolean ]>; protected readonly pdomDecrementDownEmitter: TEmitter<[ boolean ]>; - private _timerDelay = 400; - private _timerInterval = 100; + private _pdomTimerDelay = 400; + private _pdomTimerInterval = 100; private readonly _disposeAccessibleNumberSpinner: () => void; @@ -91,8 +92,8 @@ const AccessibleNumberSpinner = >( Type: Sup assertHasProperties( this, [ 'addInputListener' ] ); this._callbackTimer = new CallbackTimer( { - delay: this._timerDelay, - interval: this._timerInterval + delay: this._pdomTimerDelay, + interval: this._pdomTimerInterval } ); this.pdomIncrementDownEmitter = new Emitter( { parameters: [ { valueType: 'boolean' } ] } ); @@ -182,28 +183,28 @@ const AccessibleNumberSpinner = >( Type: Sup }; } - public set timerDelay( value: number ) { - this._timerDelay = value; + public set pdomTimerDelay( value: number ) { + this._pdomTimerDelay = value; if ( this._callbackTimer ) { this._callbackTimer.delay = value; } } - public get timerDelay(): number { - return this._timerDelay; + public get pdomTimerDelay(): number { + return this._pdomTimerDelay; } - public set timerInterval( value: number ) { - this._timerInterval = value; + public set pdomTimerInterval( value: number ) { + this._pdomTimerInterval = value; if ( this._callbackTimer ) { this._callbackTimer.interval = value; } } - public get timerInterval(): number { - return this._timerInterval; + public get pdomTimerInterval(): number { + return this._pdomTimerInterval; } /**