Skip to content

Commit

Permalink
add doc about how BarTrack listeners are used to emphasize harmonics, #…
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Sep 21, 2021
1 parent b432a87 commit 2557556
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/common/view/AmplitudeSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,16 @@ class BarTrack extends SliderTrack {
};
harmonic.amplitudeProperty.link( amplitudeListener );

// When the cursor is over the visible part of the track, it is considered highlighted.
const visibleTrackPressListener = new PressListener( {
//REVIEW: Not sure I understand what this is doing at all. `pickable:true` seems equivalent?
attach: false // so that the DragListener for the track isn't ignored
} );
visibleTrackNode.addInputListener( visibleTrackPressListener );

// @public This tells us when the track should be considered highlighted. We can't simply look at
// this.dragListener.isHighlightedProperty, because that will include the invisible portion of the track.
// This is used to emphasize the associated harmonic's plot in the Harmonics chart. See isEmphasizedProperty
// in AmplitudeSlider above.
this.isHighlightedProperty = new DerivedProperty(
[ this.dragListener.isPressedProperty, visibleTrackPressListener.isOverProperty ],
( isPressed, isOverVisible ) => ( isPressed || isOverVisible )
Expand Down

0 comments on commit 2557556

Please sign in to comment.