add sketch item/group flip h/v and centering

This commit is contained in:
Stewart Allen 2024-07-27 18:41:32 -04:00
commit e0d449af50
4 changed files with 59 additions and 1 deletions

View file

@ -120,7 +120,7 @@ class Bounds {
return this.maxy - this.miny;
}
center(z) {
center(z = 0) {
return base.newPoint(this.centerx(), this.centery(), z);
}

View file

@ -567,6 +567,16 @@ class Polygon {
return this.points[this.length - 1];
}
flip(axis) {
for (let p of this.points) {
p[axis] = -p[axis];
}
for (let i of this.inner || []) {
i.flip(axis);
}
return this;
}
swap(x, y) {
this._bounds = undefined;
if (x) {