Skip to content

Commit fe0609a

Browse files
perf(geom): internal update shape attrib copying
- rename __copyAttribsRaw => __copyAttribs - avoid extraneous fn calls
1 parent 1e12707 commit fe0609a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+164
-119
lines changed

packages/geom/src/api/aabb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class AABB implements AABBLike, IHiccupShape3<AABB> {
2626
return new AABB(
2727
set3([], this.pos),
2828
set3([], this.size),
29-
__copyAttribs(this)
29+
__copyAttribs(this.attribs)
3030
);
3131
}
3232

packages/geom/src/api/arc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class Arc implements IHiccupShape2<Arc>, IHiccupPathSegment {
3737
this.end,
3838
this.xl,
3939
this.cw,
40-
__copyAttribs(this)
40+
__copyAttribs(this.attribs)
4141
);
4242
}
4343

packages/geom/src/api/circle.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ export class Circle implements IHiccupShape2<Circle> {
1414
) {}
1515

1616
copy(): Circle {
17-
return new Circle(set2([], this.pos), this.r, __copyAttribs(this));
17+
return new Circle(
18+
set2([], this.pos),
19+
this.r,
20+
__copyAttribs(this.attribs)
21+
);
1822
}
1923

2024
withAttribs(attribs: Attribs) {

packages/geom/src/api/complex-polygon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class ComplexPolygon implements IHiccupShape2<ComplexPolygon> {
2525
return new ComplexPolygon(
2626
this.boundary.copy(),
2727
this.children.map((h) => h.copy()),
28-
__copyAttribs(this)
28+
__copyAttribs(this.attribs)
2929
);
3030
}
3131

packages/geom/src/api/cubic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class Cubic
2222
}
2323

2424
copy(): Cubic {
25-
return <Cubic>__copyShape(Cubic, this);
25+
return __copyShape(Cubic, this);
2626
}
2727

2828
withAttribs(attribs: Attribs): Cubic {

packages/geom/src/api/cubic3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class Cubic3
2222
}
2323

2424
copy(): Cubic3 {
25-
return <Cubic3>__copyShape(Cubic3, this);
25+
return __copyShape(Cubic3, this);
2626
}
2727

2828
withAttribs(attribs: Attribs): Cubic3 {

packages/geom/src/api/ellipse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class Ellipse implements IHiccupShape2<Ellipse> {
2222
return new Ellipse(
2323
set2([], this.pos),
2424
set2([], this.r),
25-
__copyAttribs(this)
25+
__copyAttribs(this.attribs)
2626
);
2727
}
2828

packages/geom/src/api/group.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class Group implements IClear, IHiccupShape2<Group> {
4444
}
4545

4646
copyTransformed(fn: FnU<IHiccupShape2>) {
47-
return new Group(__copyAttribs(this), this.children.map(fn));
47+
return new Group(__copyAttribs(this.attribs), this.children.map(fn));
4848
}
4949

5050
withAttribs(attribs: Attribs) {

packages/geom/src/api/group3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class Group3 implements IClear, IHiccupShape3<Group3> {
4444
}
4545

4646
copyTransformed(fn: FnU<IHiccupShape3>) {
47-
return new Group3(__copyAttribs(this), this.children.map(fn));
47+
return new Group3(__copyAttribs(this.attribs), this.children.map(fn));
4848
}
4949

5050
withAttribs(attribs: Attribs) {

packages/geom/src/api/path.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class Path implements IClear, IHiccupShape2<Path> {
4747
const p = new Path(
4848
this.segments.map(__copySegment),
4949
this.subPaths.map((sub) => sub.map(__copySegment)),
50-
__copyAttribs(this)
50+
__copyAttribs(this.attribs)
5151
);
5252
return p;
5353
}

0 commit comments

Comments
 (0)