Closed pixelzoom closed 1 year ago
This seems related to https://github.com/phetsims/sun/issues/830
@samreid and I discussed on Zoom. We made scrollToItemVisibleIndex
private, and changed its param to itemVisibleIndex: boolean
to clarify. Closing.
Related to #814 ...
Items can be made invisible via PhET-iO. As I understand it, that was the main motivation for #814. And that affects programmatic scrolling to those items, which currently looks a little buggy.
Relevant bits of Carousel.ts:
It looks like
scrollToItem
compensates for item visibilty. But if I callscrollToItemVisibleIndex
, I'm going to bet that it does not behave correctly if items have been made invisible via PhET-iO. (I'm doing this via inspection, did not write a test case.)The easist fix would be to make
scrollToItemVisibleIndex
private; it's only used inside of Carousel. OtherwisescrollToItemVisibleIndex
should probably be responsible for adjusting index (instead ofscrollToItem
).scrollToItemVisibleIndex
could also use better doc or a better name. It's not totally clear on first reading what a "visible index" is. I guessed what it is because I'm aware of the visibility issue.