svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
10.97k stars 1.07k forks source link

bbox() not returning the right dimensions for a path #1221

Closed svenssf closed 10 months ago

svenssf commented 2 years ago

Bug report

box = elem.bbox()

does not return the right dimensions for:

<path d="M167.13,255.08a19.24,19.24,0,0,0-17.7-11.2h-.7a19.1,19.1,0,0,0-11,3.9,19.47,19.47,0,0,0-7.9,15.7c0,.7.1,1.4.1,2.1a12.43,12.43,0,0,0-4.3-.1c-5.5.7-10.7,4.5-13.7,10.1a2.51,2.51,0,0,0,4.4,2.4c2.3-4.2,6-7,10-7.5a6.27,6.27,0,0,1,5.4,1.4,19.59,19.59,0,1,0,35.4-16.8Zm-29.8,16.5c-.2,0-.4.1-.5,0a4.25,4.25,0,0,1-1.1-.2,2.52,2.52,0,0,1-1.2-3.3c.1-.2.2-.3.3-.5a1.21,1.21,0,0,1,.5-.5.76.76,0,0,1,.4-.2c-.3-.5-.5-.9-.8-1.4a30.41,30.41,0,0,1-2.4-5.9.35.35,0,0,0-.1-.2l-.1-.2a2.73,2.73,0,0,1,1.5-2.6c.1-.1.3-.1.4-.2a2.44,2.44,0,0,1,2.2.4,2.73,2.73,0,0,1,.9,1.2l.1.2a23.88,23.88,0,0,0,3.5,7.6,42.85,42.85,0,0,0,4.2-1.5c-2.1-2.8-4.9-7.2-6-11.2-.1-.4-.2-.9-.3-1.4a2.52,2.52,0,0,1,2-2.9,2.49,2.49,0,0,1,2.6,1.2c.1.3.2.5.3.8.6,3.3,3.6,8.3,5.9,11.2a21.73,21.73,0,0,0,4.2-3.1c-1.9-3.9-3.8-6.5-6-8.2a2.53,2.53,0,0,1-.5-3.5,3.13,3.13,0,0,1,1.1-.9,2.48,2.48,0,0,1,1.7,0l.6.3a19.91,19.91,0,0,1,3,2.8,35.47,35.47,0,0,1,3.2,4.7,7.49,7.49,0,0,0,.5-1.6,2.62,2.62,0,0,1,.5-.9,2.55,2.55,0,0,1,2.6-.9c.2.1.4.1.6.2a2.43,2.43,0,0,1,1.2,2.8c-.2.7-.4,1.3-.6,1.9-3.9,10.1-16.7,14.3-24.3,16Zm29.4-8.1c-.1.1-.1.2-.2.3a19.6,19.6,0,0,1-3.8,5.7,30.54,30.54,0,0,1-15,8.5,40,40,0,0,1-4.8.8h-.2a2.5,2.5,0,0,1-.2-5c9.9-.8,17.4-6.7,19.6-12.2a2.53,2.53,0,0,1,4.7.2A2.52,2.52,0,0,1,166.73,263.48Z"/>

If you open the Pet-86.svg.txt SVG (remove .txt extension) in Illustrator or another tool you will see that for the path above (the ball in the attached svg) the dimensions are not correct.

Fuzzyma commented 2 years ago

We rely on the browser implementation for bbox calculations. If there is a bug in the browser, you need to file a bug report at the specific vendor. You can also double check with different browsers. Also: illustrator could be wrong as well

svenssf commented 2 years ago

Very true, Illustrator is correct, I’ve checked that. We use chromium together with Node. You’re of course right, I need to check with chromium.

Thx a lot for a great library and helpful reply.

/F

El El sáb, 2 oct 2021 a las 11:13, Ulrich-Matthias Schäfer < @.***> escribió:

We rely on the browser implementation for bbox calculations. If there is a bug in the browser, you need to file a bug report at the specific vendor. You can also double check with different browsers. Also: illustrator could be wrong as well

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/svgdotjs/svg.js/issues/1221#issuecomment-932719985, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWZYANBFE4TIHJUHL5QOTTUE3EKLANCNFSM5FEYU7KA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.