Closed samreid closed 1 year ago
More ideas in this patch:
Is this issue related to: https://github.com/phetsims/center-and-variability/issues/166 ?
Current patch:
From related issue https://github.com/phetsims/center-and-variability/issues/166
We created https://github.com/phetsims/sun/issues/843 in sun, because we would like to remove this line of hacky code in
CAVAccordionBox
:
backgroundNode.localBounds = backgroundNode.localBounds.copy();
This code currently provides a workaround that allows us to render the info button and dot plot points on top of the
titleNode
inAccordionBox
This patch is doing much better:
OK this patch is at a good point to review and discuss:
Problems:
The info button can be below the title bar, but should be right aligned with the checkbox icons on the right. We reaffirmed that it is really important for the data points to go up into the title bar.
I wrote in slack:
Hi Jonathan. @marlitas and @matthew-blackman and I are working on https://github.com/phetsims/center-and-variability/issues/170. A design constraint is that the content be able to go up into (across?) the title bar when expanded. @marlitas pointed out may be working in that area soon. Can you help?
UPDATE: The related issue is https://github.com/phetsims/sun/issues/803
In discussion, @jonathanolson and I discussed the design requests for this feature, and @jonathanolson said those features sound reasonable, and he hopes to work on it in the next several days. Thanks!
@jonathanolson also commented that the "make a rectangle content node and layout items within that" strategy seems reasonable for this case.
Great results from collaboration with @marlitas. We subtyped the AccordionBoxes, each subtype is adding the correct decorators. We have a better solution for layouts within the accordion box and for aligning the number lines. Still some type errors and TODOs:
Here's an idea for how we can fix those 2x hack alerts:
I decided to add some comments and TODOs to the previous comment, open a new Sun issue and commit.
AccordionBox layout commits landed, let me know if I can help with any of this.
I think we can start hitting this again tomorrow, and I imagine it will free up a lot of our workarounds. Thanks @jonathanolson!
@matthew-blackman and I wrote up notes in https://github.com/phetsims/sun/issues/843#issuecomment-1551614385
We still need to align the number lines--it was disrupted recently.
ManualConstraint has problems--when the interval tool goes all the way to the left, it shifts the number line:
We need to adjust the location of the parent so that the child ends up in the right spot--that's what's making ManualConstraint difficult to use in this case.
The imperative approach works well if we run it over and over.
Or if we make sure the play area number line + objects bounds/topology are the same as the one in the accordion box, we can align the containers. But soccer balls are wider than data points.
I addressed the review comments and TODO here. I also completed review. This issue seems ready to close to me, and any other accordionBox tweaks or bugs we notice can be sourced out to another issue.
@samreid if that all sounds right to you, please feel free to close.
I also removed the below TODO, and it's corresponding ManualConstraint. To me it didn't make sense that we would need to update the numberLine's center at any point past start-up. So I tested removing the manualConstraint in both the MeanAndMedianAccordionBox as well as the VariabilityAccordionBox while running variabilityAccordionBox.alignWithPlayAreaNumberLineNode( this.playAreaNumberLineNode.globalBounds.x );
only in the constructor. I saw no buggy behavior in a wide array of scenarios...
// TODO: https://github.com/phetsims/center-and-variability/issues/170 this seems like a misuse of ManualConstraint
@matthew-blackman and I reviewed and committed some improvements. We feel this issue can be closed, but we will open 2 smaller side issues.
There are a lot of hacks and workarounds in the accordion box. I tried to sort it out in this version, but the ManualConstraint that aligns the plot nodes is throwing things off: