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.reduce() does not remove unnecessary segments between straight lines #2092

Open
cprcrack opened this issue Nov 13, 2024 · 1 comment
Open

Comments

@cprcrack
Copy link

Description/Steps to reproduce

var path = new Path('M10,10 h10h10h10h10 v10 h-40 z');
path.selected = true;
var copy1 = path.clone(); copy1.reduce();
var copy2 = path.clone(); copy2.simplify();
var copy3 = path.clone(); copy3.flatten();
var copy4 = path.clone(); copy4.smooth({type:'continuous'});
copy1.position.x += 100;
copy2.position.x += 200;
copy3.position.x += 300;
copy4.position.x += 400;
// Expected:
var path2 = new Path('M10,10 h40 v10 h-40 z');
path2.selected = true;
path2.position.y += 50;

Link to reproduction test-case

Screenshot 2024-11-13 at 12 49 34

Expected result

By calling Path.reduce(), I expect a simple path such as M0,0 h10 h10 h10 h10 to be reduced and simplified to M0,0 h40. I also tried with simplify(), flatten() and smooth() and neither work for my purposes.

Additional information

paper 0.12.18

@cprcrack
Copy link
Author

I guess the functionality I want is provided by https://github.com/mourner/simplify-js. Can this be done with Paper.js?

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