Skip to content
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

Stop merging path of SVG on import #321

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

buckle2000
Copy link

Closes #320

@buckle2000 buckle2000 changed the title Stop merging path Stop merging path of SVG on import Dec 3, 2018
@buckle2000
Copy link
Author

I removed mergePaths plugin from svgo.

Now this test will fail.

it(`can import simple SVG with group/path transformations`, done => {
const svg = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M 0 0 L 10 10 L 20 20 L 30 30" transform="scale(2, 2)"/>
<path d="M 0 0 L 10 10 L 20 20 L 30 30" transform="scale(2, 2) rotate(180)"/>
<path d="M 0 0 L 10 10 L 20 20 L 30 30" transform="rotate(180) scale(2, 2)"/>
<path d="M 0 0 L 10 10 L 20 20 L 30 30" transform="translate(10, 20) rotate(180) scale(2, 2)"/>
<path d="M 0 0 L 10 10 L 20 20 L 30 30" transform="rotate(180) scale(2, 2) translate(10, 20)"/>
<g transform="scale(2, 2)">
<path d="M 0 0 L 10 10 L 20 20 L 30 30" transform="translate(10, 20)"/>
</g>
</svg>
`;
SvgLoader.loadVectorLayerFromSvgString(svg, () => false).then(vl => {
const paths = [
'M 0 0 L 20 20 L 40 40 L 60 60',
'M 0 0 L -20 -20 L -40 -40 L -60 -60',
'M 0 0 L -20 -20 L -40 -40 L -60 -60',
'M 10 20 L -10 0 L -30 -20 L -50 -40',
'M -20 -40 L -40 -60 L -60 -80 L -80 -100',
'M 20 40 L 40 60 L 60 80 L 80 100',
];
const actualPath = (vl.children[0] as PathLayer).pathData.getPathString();
expect(actualPath).toBe(paths.join(' '));
done();
});
});

@buckle2000
Copy link
Author

I also think we don't need collapseGroups on import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant