-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WavelengthSlider problems with pointerAreas #261
Comments
I was the author of the Java version of color-vision, and there was never a need for the |
Ah... There is some ability to change thumb touchArea. But it's done before the options 49 var thumbTouchAreaXDilation = options.thumbTouchAreaXDilation || 0.5 * thumbWidth;
50 var thumbTouchAreaYDilation = options.thumbTouchAreaYDilation || 0.5 * thumbHeight; |
(4) Buggy vertical touchArea computation. This line: 50 var thumbTouchAreaYDilation = options.thumbTouchAreaYDilation || 0.5 * thumbHeight; ... is probably a bug, and should be |
(5) touchArea shape is computed using // compute mouse/touch areas, extend up to top of track if pointerAreasOverTrack is true
var bounds = shape.bounds.copy();
if ( pointerAreasOverTrack ) {
this.touchArea = Shape.rectangle( bounds.minX - touchAreaXDilation, bounds.minY - trackHeight, bounds.width + 2 * touchAreaXDilation, bounds.height + 2 * touchAreaYDilation + trackHeight );
this.mouseArea = Shape.rectangle( bounds.minX, bounds.minY - trackHeight, bounds.width, bounds.height + trackHeight );
}
// don't extend above the thumb so that we don't encroach on slider track if pointerAreasOverTrack is false
else {
this.touchArea = Shape.rectangle( bounds.minX - touchAreaXDilation, bounds.minY, bounds.width + 2 * touchAreaXDilation, bounds.height + 2 * touchAreaYDilation );
} |
(6) Computation of pointer areas is done inside of WavelengthSlider.Thumb. It would be much easier (see 5) to do this outside of Thumb, in the WavelengthSlider constructor. (7) No way to turn off touchArea dilation for the thumb. |
I don't recall any specific requests for this feature from the design team, it seems like |
@ariel-phet requested the I agree with the usability concern. But I don't think this was addressed in a particularly good way. My proposal: Instead of extending the thumb's pointer areas into the track, the track should support "click and drag" (consistent with HSlider). This should be the default behavior, and @ariel-phet @samreid Do you see any problem with this? Or may I proceed? |
It sounds reasonable to me, but let's hear from @ariel-phet before proceeding. |
@pixelzoom agreed, please proceed |
Here's the check list of what needs to be done:
|
…dXY, shift; set thumb pointer areas outside of Thumb constructor; #261
Some of the things in inner type |
Because ArrowButton has default no-zero pointer area dilation, I was forced to compute touchArea and mouseArea for the tweaker buttons even if their dilation option values were zero. This demonstrates the problem with having non-zero pointer area defaults in common components -- it interferes with composition, and forces us to compute pointer areas that we wouldn't otherwise need. |
…length to wavelengthProperty, since it's a Property; #261
It looks like you have been making swift progress here, so perhaps I should have asked sooner: what is your opinion of generalizing HSlider so it can support WavelengthSlider? |
WavelengthSlider is a pretty specialized control, and sufficiently different that I don't think generalizing (or extending) HSlider would work out. And it's going to get even more different when I tackle #211 (add support for UV and IR wavelengths). |
In light of phetsims/sun#251 (comment), options for pointer areas should be changed to pixels instead of percentages. Review clients to see if this adversely affects them. |
Changing pointer area options from percentages to pixels moved to #266. |
@samreid Would you mind reviewing this? I know it's a lot of stuff. The only really critical issue is to confirm that WavelengthSlider now behaves like HSlider; that is, you can click and drag in the track. |
I tested the functionality on Mac Chrome with the WavelengthSlider in Bending Light screen 3 and it seemed good with respect to clicking and dragging in the track. I noticed the require statements were alphabetized, do you have an automated tool for this? @andrewadare may want to hear about it too, if it exists. I skimmed the change set and did not see any concerns. |
@andrewadare @samreid Sorry to report that sorting require statements is currently a manual process. I tend to enter them sorted to begin with, so don't have to do manual sort very often. |
(1) There are no options for setting touchArea and mouseArea for the tweaker (arrow) buttons.
(2) There are no options for setting touchArea and mouseArea for the slider thumb.
(3) There is a very odd
options.pointerAreasOverTrack
that is undocumented and has this behavior. WhenpointerAreasOverTrack:false
, the slider thumb's touchArea and mouseArea is completely below the track, e.g.:When
pointerAreasOverTrack:true
, the touchArea and mouseArea for the thumb overlap the track, e.g:Option
pointerAreasOverTrack
was added by @aaronsamuel137 in @9aae2c89441849b3ef3b5d3c7c4f0c05d2a4dfa7. bending-light and color-vision are the current clients. Unclear why it was added, or whether it's really needed. It certainly interferes with the "click in track" feature.The text was updated successfully, but these errors were encountered: