Closed pixelzoom closed 1 year ago
I spot checked quite a few sims and did not see any regressions.
@jessegreenberg randomly selected to review. Please close if this looks OK.
Change looks good! I also spot checked a few sims and don't see any layout differences. I couldn't find a dynamic screen icon to test this improvement specifically but trust it works.
The iconNode
is not owned by the ScreenIcon, is this a place where the listener needs to be disposed? I would say "no" because the ScreenIcon exists for life of sim in phet brand, but I don't know about phet-io cases.
Thanks @jessegreenberg. You are correct that, to properly dispose of a ScreenIcon, the iconNode.localBoundsProperty
listener needs to be removed. You're also correct that ScreenIcons are never disposed -- and that includes for PhET-iO. But just to be safe/future-proof, I'll go ahead and implement a proper dispose
method.
Looks like I need to address a TypeScript problem with Screen.ts in https://github.com/phetsims/joist/issues/902 before I can add dispose
to ScreenIcon. I'm going to stash my patch here in the meantime:
dispose
was added in the above commit. Closing.
While working on https://github.com/phetsims/calculus-grapher/issues/139, I discovered that ScreenIcon makes the (now incorrect) assumption that its iconNode has a static size. That's not the case if the iconNode contains a string Property that may change via PhET-iO or via change of locale.