-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Restore parsing svg elements as a parent in caso of use tag plus svg tag #2345
Conversation
ouch we added test for this :( |
no wait we need different solution. |
an overkill but a working solution. |
Need proper inspection because we should also support new viewbox from inner svgs. |
@@ -479,7 +491,7 @@ | |||
(minX * scaleX) + ' ' + | |||
(minY * scaleY) + ') '; | |||
|
|||
if (element.tagName === 'svg') { | |||
if (/^svg$/i.test(element.tagName)) { |
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.
This is so that it catches SVG and svg?
@asturur definitely need some unit tests for this. Could you please add a couple? Thanks! |
i want to improve some functionality of viewbox, very rare but i prefer to make them work. i need to create some test svg that we will use also for testing. do not parse till me signal |
we should support this: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="980" height="950" >
<defs>
<!-- Definition Motif remplissage : un seul par porte -->
<svg id="Imposte" width="465" height="130" >
<g fill="#00FF00" stroke="none" >
<rect x="10" y="10" width="15" height="15"/>
<rect x="50" y="50" width="15" height="15"/>
<rect x="50" y="10" width="15" height="15"/>
<rect x="90" y="10" width="15" height="15"/>
</g>
</svg>
<svg id="Imposte2" width="465" height="130" viewBox="15 15 465 130" >
<g fill="#0000FF" stroke="none" >
<rect x="10" y="10" width="15" height="15"/>
<rect x="50" y="50" width="15" height="15"/>
<rect x="50" y="10" width="15" height="15"/>
<rect x="90" y="10" width="15" height="15"/>
</g>
</svg>
<svg id="Imposte3" width="465" height="130" viewBox="0 0 232 65" >
<g fill="#FF0000" stroke="none" >
<rect x="10" y="10" width="15" height="15"/>
<rect x="50" y="50" width="15" height="15"/>
<rect x="50" y="10" width="15" height="15"/>
<rect x="90" y="10" width="15" height="15"/>
</g>
</svg>
</defs>
<g transform="translate(0,10)">
<use xlink:href="#Imposte" />
<use xlink:href="#Imposte2" />
<use xlink:href="#Imposte3" />
<use xlink:href="#Imposte" transform="translate(100,40)"/>
<use xlink:href="#Imposte2" transform="translate(100,80)"/>
<use xlink:href="#Imposte3" transform="translate(100,80)"/>
</g>
</svg> |
more than this we cannot go, i explain you why: Normally SVG defined by width and height, and what is outside it, and what has negative coords, is cutted out. I can implement simple viewbox clipping for the MAIN svg element but not yet for the others because we loose group information. |
Actually we are not applying viewBox scaling factor if width or height are not specified. |
ok removed useless parameters from addVBtransform. i need to find out a simple test for it. |
i lost all my changes??? |
@kangax give a review to code changes, i'll prepare the tests. |
under node js :
it means that we discard inner svg in descendat
so we are not applying eventual viewboxtransform over them. Any chance this has been fixed in node or we can change with: |
@kangax You can merge this. all svgs still parsing good. |
Restore parsing svg elements as a parent in caso of use tag plus svg tag
fixes parsing regressions from #2341 derived from #2311
closes #2341