-
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
Dynamic layout problem with AquaRadioButtonGroup #832
Comments
After replacing HStrut with AlignBox, I'm still seeing the problem. Running RPAL with this URL: Here's what the radio buttons initially look like on the Sandwiches screen: Pressing Option left-arrow once to shorten the strings looks like this: I don't understand this behavior. The buttons labels all share the same AlignGroup, so how could they have different bounds? @jonathanolson could you please take a look at this? Is it possible that there's a bug in AlignBox? Or maybe I have a problem in ReactionRadioButtonGroup. |
I don't see why an AlignGroup is needed here with the new layout features. Checkbox is a sizable component that can resize its content (the label) up when its preferred size changes. If you just give For reference, the very first example in Layout Exemplars (http://localhost:8080/phet-lib/doc/layout-exemplars.html) demos this (but doesn't show the touch areas - they are there). Happy to look into what's going on (but out of steam for the night), leaving assigned for that. |
I understand that So yes, please investigate. |
Whoops, of course this doesn't use Checkbox (as I mentioned earlier). Looks like AquaRadioButton... really doesn't support dynamic layout at all. I should probably add this. This is what gives us all the trouble: Lines 133 to 137 in 3fb63c5
AlignGroup/AlignBox working great. You create/add the first radio button, and it properly sizes the content. The first radio button gets a permanent minimum size due to this. When you create the second radio button, it's larger, so the AlignBoxes increase in size. Then it gets a larger permanent minimum size. When you later size things down, the AquaRadioButtons go down to the size of the content on initialization. Leaving self-assigned to handle this. |
I added an issue to track this, #834 |
I believe this should be patched in the issue, and working correctly in this case. Can you verify? |
Working great in RPAL, thanks! Closing. |
I encountered this while working on phetsims/reactants-products-and-leftovers#79.
In AquaRadioButtonGroup, this bit of code is causing a problem with dynamic layout:
The width of the HStrut never changes, so the content can never get narrower than its initial width.
For example, in RPAL Sandwiches screen (running with
?dev&stringTest=dynamic
), the radio buttons look like this initially:The buttons are supposed to be right justified with the layoutBounds. If the strings get longer, everything is OK:
But if the strings get shorter than they were initially, they are no longer right justified:
The solution is to get rid of the HStrut, and use AlignBox.
The text was updated successfully, but these errors were encountered: