phetsims / function-builder

"Function Builder" is an educational simulation in HTML5, by PhET Interactive Simulations at the University of Colorado Boulder.
GNU General Public License v3.0
4 stars 4 forks source link

Access of private attribute Carousel.items #152

Closed samreid closed 1 year ago

samreid commented 1 year ago

Discovered in https://github.com/phetsims/circuit-construction-kit-common/issues/630, several places in FunctionBuilder have code that accesses private instance variable Carousel.items. For instance: SceneNode.js has this code around line 343:

this.functionCarousel.items.forEach( functionContainer => {

Carousel.items was marked as private in https://github.com/phetsims/sun/commit/62874d6e04189060dd0bd99fd8f499887113dab1. Should it be marked as public? Or should function builder (and potentially other sims in the future) keep track of their own items?

pixelzoom commented 1 year ago

I see 8 occurrences:

screenshot_2133
pixelzoom commented 1 year ago

Carousel.items was marked as private in https://github.com/phetsims/sun/commit/62874d6e04189060dd0bd99fd8f499887113dab1. Should it be marked as public?

protected seems reasonable. I did not make that change because Carousel is undergoing changes in another issue.

Or should function builder (and potentially other sims in the future) keep track of their own items?

Function Builder was already keeping track of its "containers" (the items in the Carousels) so it was trivial to adjust.

Back to @samreid.

samreid commented 1 year ago

Looks good, thanks! Closing.