vitaliymaz / vscode-svg-previewer

Vscode SVG Previewer
22 stars 4 forks source link

Canvas bounding-box #21

Closed fabiopedrosa closed 5 years ago

fabiopedrosa commented 5 years ago

Could we have some dashed box to see where the SVG bouding-box is?

vitaliymaz commented 5 years ago

@fabiopedrosa, thank you for the feedback. I can see Webstorm does that, so looks useful. Proposing to make this disabled by default and add a setting to switch on.

vitaliymaz commented 5 years ago

Implemented in v0.3.2. Could be switched on by the setting option.

vincerubinetti commented 3 years ago

As implemented, it doesn't show the true viewBox. Only either the horizontal or vertical boundaries are accurate, depending on the aspect ratio of your preview window

ezgif-3-e64b7163ee3f

Probably something to do with how browsers fit SVGs to their parent containers by default.

Related lines? :

https://github.com/vitaliymaz/vscode-svg-previewer/blob/c305d7b136336076e13dc49b4df8e69b020422dd/media/preview.css#L65

https://github.com/vitaliymaz/vscode-svg-previewer/blob/c305d7b136336076e13dc49b4df8e69b020422dd/media/preview.css#L3

https://github.com/vitaliymaz/vscode-svg-previewer/blob/c305d7b136336076e13dc49b4df8e69b020422dd/preview-src/components/Preview.tsx#L29