cssho / vscode-svgviewer

SVG Viewer for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=cssho.vscode-svgviewer
MIT License
67 stars 20 forks source link

Elements not visible with 'defs' / 'use' #23

Open pedro-w opened 7 years ago

pedro-w commented 7 years ago

Elements which are defined in a defs section and then subsequently referenced by a use element are not shown. See example file. I would expect the box to be visible (as it is when loaded with Edge or with Atom's SVG preview). Using VSCode 1.7.2, SVG viewer 1.2.0.

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" 
    width="128" height="128" 
    xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<g id="box">
<rect height="20" width="20" 
    stroke="black" fill="white"/>
</g>
</defs>
<use xlink:href="#box" x="50" y="50"/>
</svg>

vscode atom

cssho commented 7 years ago

Thanx @pedro-w Fixed this issue with v1.3.0

cimbul commented 7 years ago

I'm still seeing this with v1.3.0, on VSCode 1.7.2 and macOS 10.11.6, using the exact SVG given by the OP. The same problem exists with <symbol> + <use>.

fvsch commented 7 years ago

Works for me with 1.4.2 on VSCode 1.13.1 on macOS.

Example from OP: displays alright. Another example that works:

<svg xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  viewBox="0 0 100 100">
  <rect id="foo" x="0" y="0" width="50" height="50" fill="red"></rect>
  <use xlink:href="#foo" x="50" y="50"></use>
</svg>