toLeopard: Serialize initial rotation style #118
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes
toLeopard
represent the initial rotation style (which is already represented in IR and loaded byfromSb3
).Implementation notes:
Sprite.RotationStyle.ALL_AROUND
/etc value both in block and initial-state serialization, we're mapping from different values. (sb3 block inputs like "all around" or "don't rotate" in the former, sb-edit values like "normal" or "none" in the latter.) Accordingly, it wasn't appropriate to introduce a constant mapping reused by both — but it's definitely a bit weird that sb-edit represent the input for "set rotation style" with the same values it uses for a sprite's initial rotation style.JSON.stringify
on the whole object.index.js
file needs to importSprite
from Leopard's library file now, as well asProject
(as it did before).Tested with this project: https://scratch.mit.edu/projects/877138925/
And a "boring" project that makes sure the "set rotation style" blocks are still working.
Requested both @PullJosh and @adroitwhiz for review but an OK would be fine from either of you, this isn't a big pull request and improves Scratch compatibility for Leopard in a user-visible way!