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

Variable floatPrecision #1838

Open
Paul-Browne opened this issue Nov 15, 2023 · 3 comments
Open

Variable floatPrecision #1838

Paul-Browne opened this issue Nov 15, 2023 · 3 comments

Comments

@Paul-Browne
Copy link

I would like the option to use a different floatPrecision to round stroke-width, stroke-opacity to 2dp and paths to 0dp

eg.

<path fill="none" stroke="#F9ED69" stroke-miterlimit="10" stroke-opacity=".74698" stroke-width=".33333" d="m110.5 166.7 16.8 18.4 24.9 2.8 13.5 21 24.7-4 24.2-6.2 24.4-5.4 24.8...

would become

<path fill="none" stroke="#F9ED69" stroke-miterlimit="10" stroke-opacity=".75" stroke-width=".33" d="m111 167 17 18 25 3 14 21 25-4 24-6 24-5 25...

Maybe the floatPrecision option can be extended? Something like...

const result = optimize(data, {
    multipass: true,
    floatPrecision: {
        default: 3,
        path: 0,
        strokeWidth: 2,
        strokeOpacity: 4
    }
});
@KTibow
Copy link
Contributor

KTibow commented Nov 15, 2023

relevant: #1828

@Paul-Browne
Copy link
Author

#1843

@KTibow
Copy link
Contributor

KTibow commented Nov 21, 2023

If that closes this you should add "closes #1838" to the PR description

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