Skip to content

Path.reduce() does not remove unnecessary segments between straight lines #2092

@cprcrack

Description

@cprcrack

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions