Skip to content

Set SVG skin size synchronously #497

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

Conversation

adroitwhiz
Copy link
Contributor

@adroitwhiz adroitwhiz commented Aug 13, 2019

Resolves

Solves SVGSkins' size staying small; subsequently supersedes #496, #486

This PR fixes SVG costumes' size showing as 0x0 in the editor, which was causing the GUI's SVG costume integration tests to fail as they were specifically searching for the string 100 x 100.

Proposed Changes

This PR re-merges "Skin alter push", but changes SVGSkin.setSVG() to set the costume size outside of the SVGRenderer callback rather than inside it.

It also includes a minor change (previously #486), which swaps the order of setting the skin size and calling calculateRotationCenter. This fixes calculated rotation centers.

Reason for Changes

The VM expects the skin size to be properly set immediately after calling updateSVGSkin, as it sets the costume size to the skin size after calling it. If the skin size is only set after the SVG renderer callback fires, the SVG costume size will appear as 0x0 in the editor.

Test Coverage

This appears to be, in a way, tested for in the GUI. A more explicit test over there might be a good idea.

@adroitwhiz
Copy link
Contributor Author

/cc @kchadha

@thisandagain
Copy link
Contributor

/cc @kchadha @BryceLTaylor @mzgoddard

@kchadha kchadha self-assigned this Aug 29, 2019
@@ -100,7 +114,19 @@ class SVGSkin extends Skin {
* @fires Skin.event:WasAltered
*/
setSVG (svgData, rotationCenter) {
this._svgRenderer.fromString(svgData, 1, () => {
this._svgRenderer.loadString(svgData);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

my additional changes start here

@cwillisf cwillisf changed the base branch from develop to revert-493-revert-470-skin-alter-push September 5, 2019 01:00
Copy link
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.

👍 thanks yet again!

@cwillisf cwillisf merged commit 30ef2b1 into scratchfoundation:revert-493-revert-470-skin-alter-push Sep 5, 2019
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.

4 participants