When an item visibleProperty becomes false, relayout the items on that page so there is no gap. Items from the following page move to the page.
If a page becomes empty, delete the page (note this would change the number of dots in the PageControl). If the Carousel was looking at the page that became empty, scroll back to the previous page (if there is one).
Circuit Construction Kit: DC: PhET-iO has the additional complexities:
We would like a Wire to be shown at the top of each page.
We need to distinguish between when an icon is removed from the carousel via phet-io (so that users cannot create elements of that type) vs. when the user is allowed to create elements of that type, but they have used up all of them so the icon becomes hidden (which should leave a layout hole). This relates to https://github.com/phetsims/circuit-construction-kit-common/issues/903. We normally implement this kind of behavior in PhET-iO by adding a level of nesting. i.e. the Carousel's Node visibleProperty determines whether the node is included in the layout, and it contains a child node that can be hidden if all circuit elements of that type are depleted.
In https://github.com/phetsims/circuit-construction-kit-common/issues/630 it was requested that the carousel not leave empty layout holes when circuit elements are removed via visibleProperty = false in PhET-iO. The implementation could also support non-phet-io use cases, like adding/removing the non-ohmic bulb in CCK DC (Lab screen, Advanced, Add Real Bulbs). Sim-specific details are described in https://github.com/phetsims/circuit-construction-kit-common/issues/630. Summarizing the requests:
Circuit Construction Kit: DC: PhET-iO has the additional complexities:
As far as I understand from https://github.com/phetsims/circuit-construction-kit-common/issues/630, this feature is requested for the upcoming milestone release of CCK DC PhET-iO.
@pixelzoom can you please advise how to proceed, and help us estimate the time/complexity if we implement this?