Skip to content
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

PhET-iO Design for Carousel #736

Closed
6 of 7 tasks
arouinfar opened this issue Feb 8, 2022 · 6 comments
Closed
6 of 7 tasks

PhET-iO Design for Carousel #736

arouinfar opened this issue Feb 8, 2022 · 6 comments

Comments

@arouinfar
Copy link
Contributor

arouinfar commented Feb 8, 2022

Related to phetsims/circuit-construction-kit-common#513

Here's an example of what carousel currently looks like in CCK: DC:

image

Questions:

  • Is it normal/expected for the carousel contents to be siblings of the carousel as in the screenshot above? In balancing-act, the contents are children (e.g. balancingAct.balanceLabScreen.view.massCarousel.brickStackCreatorNode1). However, I'm not sure, since that sim is ancient PhET-iO and possibly a non-standard carousel to boot.
  • Similarly, is there a reason why the pageControl is not a child of the carousel? You can hide the carousel, but leave behind the dots which seems very weird to me.

Long-term wishlist:

Desired changes:

  • carousel.visibleProperty phetioFeatured: true by default
  • carousel.pageNumberProperty phetioFeatured: true by default
  • carousel.nextButton.enabledProperty and carousel.previousButton.enabledProperty should be phetioReadOnly: true (otherwise causes problems like Carousel's Next/Previous buttons do not stay disabled in Studio circuit-construction-kit-common#844 and Going to a non-existent carousel page freezes sim circuit-construction-kit-common#848)
  • If possible, make carousel.nextButton.enabledProperty and carousel.previousButton.enabledProperty phetioFeatured: false by default. I know they inherit the phetioFeatured behavior from buttons, but in this case, it doesn't make sense to feature something that is read-only. If this can't be done within carousel itself, designers can un-feature it in the overrides instead.
  • If possible, make pageControl a child of carousel.
  • pageControl.visibleProperty phetioFeatured: true by default
  • If possible, make the visibleProperty of each Node within the carousel phetioFeatured: true by default. (If this is a sim-specific thing, designers can handle it in the overrides.)

Assigning to @zepumph and @samreid. Happy to discuss further on a call or at PhET-iO meeting if these requests are unclear/unreasonable.

@zepumph
Copy link
Member

zepumph commented Feb 10, 2022

@samreid, can you take the lead on this since you are working on this with CCK? Let me know if you would like assistance.

@zepumph zepumph removed their assignment Feb 10, 2022
samreid added a commit to phetsims/circuit-construction-kit-dc that referenced this issue Aug 15, 2022
samreid added a commit to phetsims/circuit-construction-kit-common that referenced this issue Aug 15, 2022
samreid added a commit to phetsims/circuit-construction-kit-dc that referenced this issue Aug 15, 2022
samreid added a commit to phetsims/circuit-construction-kit-black-box-study that referenced this issue Aug 15, 2022
samreid added a commit to phetsims/circuit-construction-kit-ac that referenced this issue Aug 15, 2022
@samreid
Copy link
Member

samreid commented Aug 15, 2022

I completed all the requests above except for:

If possible, make pageControl a child of carousel.

There is difficulty in this request, since PageControl can be used to control any item and Carousel doesn't define how PageControl layout works. Here are some options:

  • Leave it as it is and see if it is good enough. The major downsides of the current implementation are (a) pageControl not nested under carousel, and making the carousel invisible doesn't hide the page controls
  • Leave the architecture as it is, but nest the pageControl tandem under the carousel tandem (without changing the scene graph). This would fix the tandem tree, but would still leave the page control visible if the user hides the carousel.
  • Wire up the visibility of the page control to the visibility of the carousel. This would be easy if it is "always matched" and more complex if we want to make it so the page control can be hidden while the carousel is still showing
  • Both of the above bullet points could be implemented
  • Reimplement carousel so that it creates and is aware of its nested PageControl, and manages the layout, tandem, visibility, etc. This would be more work but maybe is best for the long run. Would decrease flexibility but make it simpler for other sims to match the same pattern.

My recommendation is that the current implementation is very flexible. Showing the page control outside of the carousel tandem seems reasonable to me, since they are side by side. We could introduce a carouselContainer node that contains both if the user needs one shutoff valve. But also, I don't think it's too much to ask a client to hide the carousel and the page controls if that is the desired behavior.

Ready for review and discussion.

@arouinfar
Copy link
Contributor Author

@samreid I reviewed in CCK:DC, and the carousel looks great! Thanks for providing more context around PageControl. I don't think we should force it anywhere or wire it up in an unorthodox way.

We could introduce a carouselContainer node that contains both if the user needs one shutoff valve.

Currently carousel and pageControl are both children of circuitElementToolbox. Can we create circuitElementToolbox.visibleProperty?

@arouinfar arouinfar assigned samreid and unassigned arouinfar Aug 15, 2022
samreid added a commit to phetsims/circuit-construction-kit-common that referenced this issue Aug 16, 2022
@samreid
Copy link
Member

samreid commented Aug 16, 2022

In the commit, I instrumented circuitElementToolbox and additionally featured its visibleProperty. Let me know if that last part is not desired or if it should be in the overrides. Otherwise, ready for review and please close if all is well.

@samreid samreid assigned arouinfar and unassigned samreid Aug 16, 2022
@arouinfar
Copy link
Contributor Author

Thanks @samreid. I think circuitElementToolbox.visibleProperty looks good, and it should certainly be phetioFeatured: true. It seems appropriate to handle in the overrides since it is sim-specific, but I'll leave that up to you.

@arouinfar arouinfar assigned samreid and unassigned arouinfar Aug 19, 2022
@samreid
Copy link
Member

samreid commented Aug 21, 2022

Sounds good, thanks! I also noted that the phetioFeatured: true is advantageous in the code since circuit-construction-kit-common is used by several sims. Closing.

@samreid samreid closed this as completed Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants