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

Implement nannou::geom::path::Builder end method #908

Closed
wants to merge 1 commit into from

Conversation

Swiddis
Copy link

@Swiddis Swiddis commented Mar 6, 2023

The nannou::geom::path::Builder doesn't expose the internal lyon::path::path::Builder's end method, which leads to validation panics when a path is built outside of release mode. Reproducable example (must be run without --release, Lyon's path validator is turned off if the flag is enabled):

use nannou::prelude::*;
use nannou::geom::path;

fn main() {
    let mut builder = path();
    builder = builder.begin(vec2(-50.0, 0.0));
    builder = builder.quadratic_bezier_to(vec2(0.0, 25.0), vec2(50.0, 0.0));
    let _path = builder.build();
}

Since Lyon's Builder::end isn't exposed by Nannou, the only clearly documented way out is with close, but that's undesirable as it forces a closed loop. A workaround for this is to use path.inner_mut().end(false);, but for convenience this PR adds it to the Builder directly.

Requiring paths to be properly ended before build was added in Lyon v0.17. I see that an end method was correctly added with the version bump, but it wasn't published.

Resolves #933

No longer requires accessing internals for the same functionality
@Swiddis Swiddis closed this Nov 6, 2024
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.

Drawing a path with nannou::geom::path should expose lyon's end() method on builder
1 participant