Skip to content

Bounding Box not calculated correctly #50

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

Closed
nattyluke opened this issue Jan 28, 2025 · 2 comments
Closed

Bounding Box not calculated correctly #50

nattyluke opened this issue Jan 28, 2025 · 2 comments

Comments

@nattyluke
Copy link

const d =
            'm 178.85352,24.814453 a 2.50025,2.50025 0 0 0 -1.47657,1.240234 l -6.79883,13.201172 a 2.50025,2.50025 0 0 0 1.03321,3.34375 l 3.69922,2 a 2.50025,2.50025 0 0 0 1.94922,0.134766 2.50025,2.50025 0 0 0 0.66601,1.171875 l 6.19922,3.300781 a 2.50025,2.50025 0 0 0 3.39062,-1.048828 l 6.9004,-13.199219 a 2.50025,2.50025 0 0 0 -1.02735,-3.357422 l -3.69922,-2 a 2.50025,2.50025 0 0 0 -2.71679,0.46875 2.50025,2.50025 0 0 0 -1.30079,-2.478515 l -4.90039,-2.59961 a 2.50025,2.50025 0 0 0 -1.91796,-0.177734 z m -0.11329,9.513672 a 2.50025,2.50025 0 0 0 0.58789,0.871094 2.50025,2.50025 0 0 0 -0.99414,-0.08398 z m 7.73243,4.867187 a 2.50025,2.50025 0 0 0 0.0801,0.01172 l -0.0273,0.05273 a 2.50025,2.50025 0 0 0 -0.0527,-0.06445 z';

Width & Height of this path is not calculated correctly:

width: 194.7002513469969,
height: 49.50023463234929,

While svg-path-bbox does the job right:

width: 194.70072731240975 - 170.30023845548806 = 24.400488856921697 
height: 49.500238436244636 - 24.70053937716671 = 24.799699059077927

Something to do when youre bored ;) thanks for your library btw

@thednp
Copy link
Owner

thednp commented Jan 28, 2025

Which version are you on? I just closed #47 with a similar issue.

I tested your code at the demo site, working as expected.

Shape bounding box length is: 
 width: 24.39943107791936
 height: 24.799510055950556
 x: 170.30068516742276
 y: 24.70087353625376
 x2: 194.70011624534212
 y2: 49.500383592204315
 cx: 182.50040070638244
 cy: 37.10062856422904
 cz: 36.999225594910236

@thednp thednp closed this as completed Jan 28, 2025
@nattyluke
Copy link
Author

Update 2.1.7 → 2.1.8 fixes this problem, sorry thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants