-
Notifications
You must be signed in to change notification settings - Fork 336
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 setRotationCenter API #581
Remove setRotationCenter API #581
Conversation
ad2af11
to
dd19d0e
Compare
const changed = ( | ||
toFloat32(x) !== this._rotationCenter[0] || | ||
toFloat32(y) !== this._rotationCenter[1]); | ||
if (!emptySkin && changed) { |
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.
Note: this is replaced by https://github.com/LLK/scratch-render/pull/561/files
@@ -1444,9 +1418,6 @@ class RenderWebGL extends EventEmitter { | |||
if ('skinId' in properties) { | |||
this.updateDrawableSkinId(drawableID, properties.skinId); | |||
} | |||
if ('rotationCenter' in properties) { |
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.
We might want to document the properties, but not necessarily in this PR
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.
I guess if this function is going away it doesn't matter
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.
LGTM, thanks!
FYI test is falling because playwright only supports node 10+ but it's still node 8 |
dd19d0e
to
d9c854f
Compare
Resolves
A step on the long-ish path towards fixing #550
Also a step towards fixing #570
Proposed Changes
This PR removes the API for setting a drawable's rotation center and the
Skin.setRotationCenter
function.It does not remove the API for setting a skin's rotation center when setting its contents.
To fix unit tests which previously called
Skin.setRotationCenter
, it also adds arotationCenter
setter (plus corresponding getter) toMockSkin
, which the unit tests now use.I'm not expecting this to be merged right away--in case scratchfoundation/scratch-vm#2314 causes any regressions in the near future, it'll probably be beneficial to be able to revert that without having to re-add the rotation center API here as well.
Reason for Changes
In order to fix (no, GitHub, it doesn't close) #550, vector costumes' SVG viewboxes must depend on their rotation centers. Every time the viewbox of an SVG is set, its
<img>
must be updated as well, which is a fundamentally asynchronous operation.As such, a synchronous API for setting a skin's rotation center after the skin is loaded is incompatible with the changes necessary for #550.
With scratchfoundation/scratch-vm#2314 merged, that synchronous API is no longer used and can be removed.