Skip to content

Commit

Permalink
add tandem for slider thumb, see #54
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Jan 10, 2025
1 parent 0caaec9 commit 8ed59c3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions js/bloch-sphere/view/MeasurementTimerControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export default class MeasurementTimerControl extends Node {
measurementTimeProperty: NumberProperty,
providedOptions: MeasurementTimerControlOptions ) {

// Create the tandem for the slider, since we'll need it for other things before creating the slider itself.
const sliderTandem = providedOptions.tandem.createTandem( 'timeToMeasurementSlider' );

// Create the thumb node for the slider that will control the time at which the system is measured.
const thumbOffset = 30;
const thumbDimensions = new Dimension2( 30, 30 );
const thumbPathOptions = {
Expand All @@ -63,7 +67,8 @@ export default class MeasurementTimerControl extends Node {
scale: 0.8,
stroke: 'black'
} )
]
],
tandem: sliderTandem.createTandem( 'thumbNode' )
} );

// highlight thumb on pointer over
Expand All @@ -76,10 +81,11 @@ export default class MeasurementTimerControl extends Node {
} );
thumbNode.addInputListener( pressListener );

// Create the slider that will control the time at which the system is measured.
const maxMeasurementTime = timeToMeasurementProperty.rangeProperty.value.max;
const minMeasurementTime = timeToMeasurementProperty.rangeProperty.value.getLength() / ( NUMBER_OF_MINOR_TICKS + 1 );
const timeToMeasurementSlider = new Slider( timeToMeasurementProperty, timeToMeasurementProperty.range, {
tandem: providedOptions.tandem.createTandem( 'timeToMeasurementSlider' ),
tandem: sliderTandem,
thumbNode: thumbNode,
thumbYOffset: thumbOffset - 8,
trackSize: SLIDER_TRACK_SIZE,
Expand Down

0 comments on commit 8ed59c3

Please sign in to comment.