Calculate rotation center if it's not supplied#70
Conversation
When a new skin is added, previously the rotation center was set to `[0, 0]`. In the case of costumes and backdrops added from libraries, the center should be calculated from the bounding box of the imported skin. Toward scratchfoundation/scratch-gui#18
cwillisf
left a comment
There was a problem hiding this comment.
I think this is fine as is, but I wonder if it would be better to always calculate the rotation center as [w/2, h/2] initially rather than take a flag for that. If the client immediately overrides that then that's fine - it wasn't a very expensive computation to begin with.
One complication would be if the client creates a skin, then sets the rotation center, then the skin finishes downloading: we'd need to avoid overriding the user-set rotation center in that case. Maybe that added complexity isn't worth it.
Thoughts?
I thought about always calculating the center, but it would require us to deal with the edge case of manually setting the center while the skin is still downloading (since we would start the download and then immediately set the rotation center here). What if we passed in |
That sounds good to me. |
This is more explicit than the previous behavior, and more in line with the way we supply the costumeResolution
This is to remain compatible with scratchfoundation/scratch-render#70
When a new skin is added, previously the rotation center was set to
[0, 0]. In the case of costumes and backdrops added from libraries, the center should be calculated from the bounding box of the imported skin.Toward scratchfoundation/scratch-gui#18