-
Notifications
You must be signed in to change notification settings - Fork 12
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
HSlider: use pixels instead of percentages for touchArea default #254
Comments
The bit of code to be changed is at line 162: // Touch area for the default thumb. If a custom thumb is provided, the client is responsible for its touchArea.
if ( !options.thumb ) {
if ( options.thumbTouchAreaXDilation === null ) {
options.thumbTouchAreaXDilation = 0.5 * thumb.width;
}
if ( options.thumbTouchAreaYDilation === null ) {
options.thumbTouchAreaYDilation = 0.25 * thumb.height;
}
// touch area dilated along X and Y directions
thumb.touchArea = thumb.bounds.dilatedXY( options.thumbTouchAreaXDilation, options.thumbTouchAreaYDilation );
} |
Proposal: Change the default touch dilations to be 0.5 and 0.25 of the default thumb width and height respectively. I.e., thumbSize: new Dimension2( 22, 45 ),
...
thumbTouchAreaXDilation: 11,
thumbTouchAreaYDilation: 11, This will preserve the existing behavior for clients that use the default thumb size. And I can identify clients whose behavior may change by searching for "thumbSize:". @samreid Do you forsee any problems with this plan? |
45 occurrences of "thumbSize:" in 25 sims. This will be a lot of work. |
Likewise I see 3 places where I don't see any other problems with the plan, but would recommend to test a case or two manually and make sure things are matching up as expected, perhaps by console.logging the touch area before/after to make sure it is preserved. |
@samreid said:
When a custom thumbNode is provided, the client is responsible for its pointer areas, as indicated in the documentation: 55 // Dilation of touchArea for default thumb, ignored for custom thumb. |
I see that now, thanks for showing me. Everything seems good to proceed. |
I might as well add mouseArea options while I'm at it. |
…rea, adjust in one client, test in sun demo, #254
…rea, adjust in one client, test in sun demo, phetsims/sun#254
Skype discussion about how to fix clients:
Issues have been created for all sims that require adjustment, see list of issues immediately above. These are the sims that create one or more HSliders with the |
I took care of all the sims that didn't have a clear primary developer (color-vision, etc.) The remaining issues are assigned to their respective primary developer(s). |
@jbphet selected at random to review. |
The commits all look good. I tested by running the sun demo with |
In light of #251 (comment), HSlider's defaults for touchArea should be changed to pixels instead of percentages. This will certainly affect many clients.
The text was updated successfully, but these errors were encountered: