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

Improve svg rendering #974

Merged
merged 7 commits into from
Jan 23, 2022
Merged

Improve svg rendering #974

merged 7 commits into from
Jan 23, 2022

Conversation

z3dev
Copy link
Member

@z3dev z3dev commented Jan 2, 2022

These changes improve the 'rendering' of designs exported to SVG.

  • set defaults for fill, fill-rule, stroke-width at the SVG level
  • remove above from path serialization
  • corrected fill color for continuous paths (geom2)
  • added support for special attributes; id and class

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Does your submission pass tests?

@z3dev z3dev requested a review from hrgdavor January 2, 2022 11:42
@z3dev
Copy link
Member Author

z3dev commented Jan 2, 2022

@hrgdavor please review / try if you have time. I think these changes will help users when exporting to SVG.

@z3dev
Copy link
Member Author

z3dev commented Jan 2, 2022

See #558 for how to add a ‘name’ to objects. Probably, support for ‘id’ and ‘class’ is enough.

@hrgdavor
Copy link
Contributor

hrgdavor commented Jan 2, 2022

np. I will take a look a bit and test

@hrgdavor
Copy link
Contributor

hrgdavor commented Jan 3, 2022

It will be few days before I can do so, I am traveling today and tomorrow, so I can't test this right away

@hrgdavor
Copy link
Contributor

I have been playing with it, and it looks good in the svg source. I am not a fan of using fill.

While jscad renders lines
image

the svg export uses fill

image

personally I would prefer stroke
image

@hrgdavor
Copy link
Contributor

I have some complaint/proposals that are unrelated to this PR.

jscad is generating poly for each curve immediately, so an export to SVG is a poly instead of circle, arc, besier.

Without changing jscad core, one option would be to explore integration with other 2d libs like maker.js ... actually all that is needed is to improve require in the future because V2 now allows us to script with any valid JS lib.

Copy link
Contributor

@hrgdavor hrgdavor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a good step forward.

@z3dev z3dev merged commit ca91bb9 into master Jan 23, 2022
@z3dev z3dev mentioned this pull request Jan 23, 2022
@z3dev z3dev deleted the improve-svg-rendering branch February 11, 2022 03:20
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

Successfully merging this pull request may close these issues.

2 participants