phetsims / scenery-phet

Reusable components based on Scenery that are specific to PhET simulations.
http://scenerystack.org/
MIT License
9 stars 6 forks source link

Improve the implementation of cue Node transformations in GrabDragInteraction #775

Open jessegreenberg opened 2 years ago

jessegreenberg commented 2 years ago

From https://github.com/phetsims/scenery-phet/issues/447, there is a remaining piece of work:

I don't understand these linese yet. FocusOverlay uses TransformTracker for transformations up the trail, will that be sufficient since the cues are added as children to the focus highlights? Why do we need to prepend nodes matrix?

I think I understand now. The pink FocusHighlightFromNode surrounds the node's local bounds, but is added to the global coordinate frame in FocusOverlay. So likewise, the cue nodes (or children added to the focus highlights) need to be transformed by the node's local transformation matrix to be positioned correctly when transformed by the node's localToGlobalMatrix in FocusOverlay.update().

Yes this is less than ideal, and it was the cause of https://github.com/phetsims/friction/issues/181. I would love to find a different solution that was more robust.

We haven't run into trouble with transforming the cue Node thus far (with 4 production usages). Perhaps we can work on it if we every run into trouble. Presumably it would be very obvious when the matrix is off (I'm sorta shrugging over here).

It would be good to improve this. We haven't had problems over several years, so it is probably low priority until we do.

zepumph commented 2 years ago

Subset of https://github.com/phetsims/scenery/issues/1298