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

Unable to fill a simple path #164

Closed
SteveXCIV opened this issue Jun 25, 2022 · 2 comments
Closed

Unable to fill a simple path #164

SteveXCIV opened this issue Jun 25, 2022 · 2 comments

Comments

@SteveXCIV
Copy link

What I Did

Created a triangle using PathBuilder and added a bundle from the resulting Path using GeometryBuilder and DrawMode::Fill.

Expected Outcome

A triangle is drawn.

Actual Outcome

Nothing appears.

Steps to Reproduce

Gist here: https://gist.github.com/SteveXCIV/99515e05d68694155b3ea9d2e4af7c49

Additional Information

Maybe related to #160 since my triangle does have points that are very close to each other. One thing I did note in the gist above is that using DrawMode::Stroke does the expected thing and draws a line. So it seems to me that the geometry itself isn't broken and it's something to do with the material generated for a filled shape, but I'm not sure.

@SteveXCIV
Copy link
Author

Quick update; I don't think this is related to the points being close together. I tried a quick experiment with my gist code above where I multiplied each point by 50.0 and then scaled by the reciprocal using the Transform and I'm still seeing only the stroke render.

@SteveXCIV
Copy link
Author

I'm closing this issue because the problem ended up being the way I was creating my path. For anyone who finds this in the future, you can't call move_to between each vertex as this will close the in-progress path, so the general pattern should be:

builder.move_to(start);
for endpoint in endpoints.iter() {
    builder.line_to(endpoint.clone());
}
builder.close(); // optional, if you want to connect the start to the end

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