extend approach. need to switch to segment comparison w/ angles
This commit is contained in:
parent
f8180fe79a
commit
78d4d606a4
2 changed files with 83 additions and 26 deletions
|
|
@ -2326,7 +2326,7 @@ export class Polygon {
|
|||
|
||||
// split long straight lines into segments no longer than max
|
||||
// and return a new polygon
|
||||
segment(max = 1, mark) {
|
||||
segment(max = 1, mark, wrap) {
|
||||
const newp = [];
|
||||
const points = this.points;
|
||||
const length = points.length;
|
||||
|
|
@ -2358,6 +2358,9 @@ export class Polygon {
|
|||
}
|
||||
}
|
||||
if (newp.length > length) {
|
||||
if (wrap) {
|
||||
newp.push(newp[0]);
|
||||
}
|
||||
return newPolygon().addPoints(newp.map(p => p.clone(['segment']))).setOpenValue(this.open);
|
||||
}
|
||||
return this;
|
||||
|
|
|
|||
Loading…
Reference in a new issue