Closed jbphet closed 2 months ago
I got some help from @marlitas on this, and we discovered that the preferred height and width are zero for these buttons. Here's a screen shot:
We also found that adding any content to the buttons makes them lay out correctly, though they seem to size themselves a little oddly. Here is a screenshot of a case where I added the option content: new Text( 'X' )
to each of the momentary buttons in demoMomentaryButtons.ts
:
This led @marlitas and I to conclude that this is a general problem with WidthSizable
, specifically its handling of the case where a button has no content. With this in mind, I'm going to move this issue to the scenery repo, change the name, and assign it to @marlitas and @jonathanolson.
I ran into a buttonConstraint layout issue in Number Line Integers as well. I don't think they're exactly related, but seem to be in the same area. In this case ButtonNodeConstraint
is not setting the correct minimumHeight
for a RoundButton
if the radius
option is not passed in by the client.
The below patch fixes the bug I encountered, but also feels like it might be potentially mis-using minUnstrokedHeight
and minUnstrokedWidth
.
Would like to discuss with @jonathanolson
Tracking progress in button-layout branch
@jbphet I believe this is resolved. Do you mind checking briefly?
Sun demo (where the problem was initially noticed) is lookin' good:
Also, the values shown by the Scenery helper seem more reasonable:
I also checked the case where text content is added to the buttons as a sort of a regression test, and it looked fine.
@jonathanolson - Hopefully this is what you meant by "checking briefly". Let me know if you need any additional review. I haven't review the code, just the behavior.
Yup, thanks! Closing.
Saw this in the sun demo just now while testing changes for https://github.com/phetsims/sun/issues/292.