-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove calls to updateDrawableSkinIdRotationCenter #2314
Remove calls to updateDrawableSkinIdRotationCenter #2314
Conversation
53437b8
to
a434bc5
Compare
Make sure you test this after merging scratchfoundation/scratch-render#561 -- there are some existing rotation-center-related issues in the codebase that may interfere with testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me... assigned to @fsih pending testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good!
Proposed Changes
This PR removes calls to
Renderer.updateDrawableSkinIdRotationCenter
, replacing them with calls toRenderer.updateDrawableSkinId
.It also fixes
loadBitmap_
to properly set bitmap costumes' rotation centers.Reason for Changes
Everywhere in the current codebase, updating a drawable's rotation center should do nothing.
It appears to be a vestige of the time when rotation centers belonged to
Drawable
s and notSkin
s (the code to update drawables' rotation centers was added Oct 9, 2016,Skin
s were introduced Dec 28, 2016).Fixing a long-standing bug with vector costumes in
scratch-render
(see scratchfoundation/scratch-render#550 for a detailed writeup) involves changes to the way vector costumes' rotation centers are set; notably, changing the rotation center requires re-loading the SVG. Supporting the ability to set a skin's rotation center after it is created makes the requiredscratch-render
fix much harder to implement.Furthermore, since the functionality to set a
Drawable
's rotation center is currently effectively unused, changing the parts ofscratch-render
that involve rotation centers could break it unknowingly, causing future headaches if others try to use the API.Finally, as I mentioned earlier, rotation centers now belong to
Skin
s (which correspond to costumes), so it doesn't make sense to consider them a "Drawable
property".There was one case in which updating a costume's rotation center actually did something: when first loading a bitmap, the costume rotation center was not divided by 2. The call to
updateDrawableSkinIdRotationCenter
when setting a target's costume, which did properly set the rotation center for bitmap costumes, hid this oversight.