SliderTrack¶
Overview¶
Shows a track on a slider. Must be supplied a Node for rendering the track.
@author Chris Malley (PixelZoom, Inc.) @author Sam Reid (PhET Interactive Simulations) @author Jesse Greenberg (PhET Interactive Simulations)
Class SliderTrack¶
Constructor¶
new SliderTrack( valueProperty : TProperty<number>, trackNode : Node, range : Range | TReadOnlyProperty<Range>, providedOptions? : SliderTrackOptions )¶
Instance Methods¶
dispose()¶
Instance Properties¶
minimumSize : Dimension2¶
(protected, readonly)
internalWidthProperty : TReadOnlyProperty<number>¶
(protected, readonly)
sizeProperty : TReadOnlyProperty<Dimension2>¶
(protected, readonly)
valueToPositionProperty : TReadOnlyProperty<LinearFunction>¶
(readonly)
For use by Slider, maps the value along the range of the track to the position along the width of the track
dragListener : DragListener¶
(readonly)
public so that clients can access Properties of the DragListener that tell us about its state See https://github.com/phetsims/sun/issues/680
leftVisualOverflow : number¶
(readonly)
rightVisualOverflow : number¶
(readonly)
Type SliderTrackOptions¶
- size?: Dimension2
NOTE: for backwards-compatibility, the size does NOT include the extent of the stroke, so the track will be larger than this size - startDrag?: ( e: SceneryEvent ) => void
called when a drag sequence starts - drag?: ( e: SceneryEvent ) => void
called at the beginning of a drag event, before any other drag work happens - endDrag?: ( e: SceneryEvent | null ) => void
called when a drag sequence ends - constrainValue?: ( n: number ) => number
called before valueProperty is set - enabledRangeProperty?: TReadOnlyProperty<Range>
Defaults to a constant range - soundGenerator?: ValueChangeSoundPlayer | null
This is used to generate sounds when clicking in the track. If not provided, the default sound generator will be created. If set to null, the slider will generate no sound. - valueChangeSoundGeneratorOptions?: ValueChangeSoundPlayerOptions
Options for the default sound generator. These should only be provided when using the default. - voicingOnEndResponse?: VoicingOnEndResponse
Announces the voicing response at the end of an interaction. Used by AccessibleValueHandler, see Slider for an example usage. - leftVisualOverflow?: number
Since our historical slider tracks extend PAST the 0,size range (e.g. with strokes), and this information is needed so we can control the size based on our preferredWidth. We'll need the size to be somewhat smaller than our preferredWidth - rightVisualOverflow?: number
- & NodeOptions
Source Code¶
See the source for SliderTrack.ts in the sun repository.