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

Path has been break apart when applying roughness = 2 #162

Open
haan123 opened this issue May 23, 2020 · 2 comments
Open

Path has been break apart when applying roughness = 2 #162

haan123 opened this issue May 23, 2020 · 2 comments

Comments

@haan123
Copy link

haan123 commented May 23, 2020

I have a path like this:
https://jsfiddle.net/qetypnac/2/

  • This is the shape when roughness = 0
generator.path(pathData, {
  "stroke": "#000000",
  "fill": "#ced4da",
  "fillStyle": "solid",
  "strokeWidth": 1,
  "roughness": 2,
  "seed": 1067011870,
  "combineNestedSvgPaths": true
})

image

  • But when roughness = 2, the paths of eclipse inside are break apart

image

I don't know this is a bug a not, but is there any work around to reduce the breaking parts of eclipse?

Thanks!

@pshihn
Copy link
Collaborator

pshihn commented May 24, 2020

The path you're drawing is not drawing a circle but a series of arcs. Those arcs get more exaggerated with higher roughness. You can update your path string to have a single arc

@haan123
Copy link
Author

haan123 commented May 24, 2020

Hi @pshihn,

That's an approach, but is there an API from roughjs to convert an eclipse shape to single arc path?
Because the eclipse in the above shape was generated from roughjs generator.ellipse then it was used to do subtract boolean operation with the rectangle shape:

const rectangle = generator.rectangle(...);
const path1 =  generator.toPaths(rectangle);
const ellipse = generator.ellipse(...);
const path2 = generator.toPaths(ellipse);

subtract(path1, path2);

Thank you!

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