blueswen / mkdocs-glightbox

A MkDocs plugin supports image lightbox (zoom effect) with GLightbox.
https://blueswen.github.io/mkdocs-glightbox/
MIT License
115 stars 14 forks source link

Zoom doesn't work with svg #30

Open jeet-pixxel opened 5 months ago

jeet-pixxel commented 5 months ago

Hi, not sure if this is supposed to work this way. PNG images open and zoom fine, but SVG images are not zoomable at all. Any solution?

tIsGoud commented 4 months ago

Maybe related, some svg files work fine like the files generated by Excalidraw but the files generated by Mermaid are even smaller in GLightBox than what is displayed normally.

jeet-pixxel commented 4 months ago

Could be. My SVG files are plantUML generated.

bocytko commented 1 week ago

I had the same issue with SVGs from Google Slides (very small view). I checked what Excalidraw writes into the SVG – seems that it sets width and height attributes for svg explicitly. After doing the same in the affected SVG, I got a proper, zoomed preview.

very small image

<svg version="1.1" viewBox="0.0 0.0 960.0 540.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">

normal size image

<svg version="1.1" viewBox="0.0 0.0 960.0 540.0" width="960" height="540" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">

2x image

<svg version="1.1" viewBox="0.0 0.0 960.0 540.0" width="1920" height="1080" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">