Skip to content

Calculate rotation center if it's not supplied#70

Merged
rschamp merged 3 commits intoscratchfoundation:developfrom
rschamp:bugfix/new-skins-without-rotationCenter
Jan 25, 2017
Merged

Calculate rotation center if it's not supplied#70
rschamp merged 3 commits intoscratchfoundation:developfrom
rschamp:bugfix/new-skins-without-rotationCenter

Conversation

@rschamp
Copy link
Copy Markdown
Contributor

@rschamp rschamp commented Jan 13, 2017

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

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
Copy link
Copy Markdown
Contributor

@cwillisf cwillisf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@rschamp
Copy link
Copy Markdown
Contributor Author

rschamp commented Jan 13, 2017

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.

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 rotationCenter to createSkinFromURL rather than the calculateRotationCenter flag, and calculate it if rotationCenter is undefined? It wouldn't help the case of someone changing the center before the skin downloads, but in this situation it would be an edge case we could deal with later.

@cwillisf
Copy link
Copy Markdown
Contributor

cwillisf commented Jan 13, 2017

What if we passed in rotationCenter to createSkinFromURL rather than the calculateRotationCenter flag, and calculate it if rotationCenter is undefined?

That sounds good to me.

Ray Schamp added 2 commits January 25, 2017 09:28
This is more explicit than the previous behavior, and more in line with the way we supply the costumeResolution
rschamp pushed a commit to rschamp/scratch-gui that referenced this pull request Jan 25, 2017
@rschamp rschamp removed the question label Jan 25, 2017
@rschamp rschamp merged commit 2fc9005 into scratchfoundation:develop Jan 25, 2017
@rschamp rschamp deleted the bugfix/new-skins-without-rotationCenter branch January 25, 2017 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants