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

Inconsistent behavior with polyStroke() #314

Open
thykka opened this issue Jan 18, 2020 · 2 comments
Open

Inconsistent behavior with polyStroke() #314

thykka opened this issue Jan 18, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@thykka
Copy link

thykka commented Jan 18, 2020

I noticed that polyStroke() has a quirk, where given 2 or 5 arguments, it draws unclosed polygons, i.e.:

polyStroke([
  // empty array as last point
  [0,0], [64, 0], [64, 64], []
], 5)

image

When given 3 arguments however, it doesn't draw anything. I'm guessing this behavior appears because this:

Math.min.apply(
  Math,
  [[0,0], [1,1], []].map(p => p[0])
)

...would return NaN

Since drawing unclosed polylines has plenty of use-cases, perhaps this behaviour should be parametrized, and unified across the different drawing implementations?

@gabrielflorit
Copy link
Owner

Oh interesting. Very interesting. Would you be able to provide image examples for each quirk?

@gabrielflorit gabrielflorit added the bug Something isn't working label Jan 23, 2020
@thykka
Copy link
Author

thykka commented Jan 23, 2020

The 3 argument version simply draws nothing, whereas the 5 argument version behaves like 2.

Test case cassette

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants