Skip to content
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

Account for element size as well as position when computing boundaries #41

Open
jni opened this issue Jun 19, 2024 · 1 comment
Open

Comments

@jni
Copy link
Member

jni commented Jun 19, 2024

Currently, we compute a tight bounding box around the coordinates of all the elements (line endpoints, circle centers, polygon vertices, etc) and output that as the bounds of the output svg. This results in clipped points and lines around the edges of the svg, see e.g. https://github.com/napari/napari-svg/blob/38fae845161c220b42b0c17dc844904300be5735/napari_svg/_tests/test_write_points_with_attributes-expected.svg.

We should instead compute the size of each element and expand the bounds by that amount. We could even be conservative around this since generally I think it's ok to have a bit of whitespace around the elements. This would help in computation since we could just find the largest element and pad the extrema by that amount, rather than have to figure out padding for each point.

@jni
Copy link
Member Author

jni commented Jun 19, 2024

Note: Until this issue is resolved, there is a workaround: add a shapes layer with a transparent fill and zero border, containing a single rectangle matching the extent you want for the svg.

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

1 participant