Skip to content

Conversation

rudashi
Copy link
Contributor

@rudashi rudashi commented Nov 26, 2019

This change enables the user to transform the svg before it's processed by the component.

It's different approach for @econic solution.

This change enables the user to transform the svg before it's processed by the component.

It's different approach for @econic solution.
@shrpne
Copy link
Owner

shrpne commented Nov 26, 2019

Nice!

Can you add corresponding prop to the component and some docs about it, please?

This example create circle in svg:

```
<inline-svg :src="require(`./../../assets/svg/${computedMap.image}`)" :transformSource="transform"/>

....

const transform = (svg) => {
	let point = document.createElementNS("http://www.w3.org/2000/svg", 'circle');
        point.setAttributeNS(null, 'cx', '1376.7');
        point.setAttributeNS(null, 'cy', '565.8');
        point.setAttributeNS(null, 'r', '10');
        point.setAttributeNS(null, 'fill', 'red');
        svg.appendChild(point);
	return svg;
}
```
For cleaner syntax you could use https://github.com/svgdotjs/svg.js
@shrpne shrpne merged commit 80f4d69 into shrpne:master Nov 26, 2019
@shrpne
Copy link
Owner

shrpne commented Nov 26, 2019

Thank you!

Published under v1.2.0 tag

@rudashi rudashi deleted the rudashi-patch-1 branch November 26, 2019 13:58
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.

2 participants