Skip to content

Commit 41e81c0

Browse files
committed
chore: " to ' and remove useless ;
1 parent 8371eda commit 41e81c0

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

paint.js

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
11
class SmoothCornersPainter {
22
static get inputProperties() {
3-
return ["--smooth-corners"];
3+
return ['--smooth-corners']
44
}
55

66
superellipse(a, b, nX = 4, nY) {
7-
if (Number.isNaN(nX)) nX = 4;
8-
if (typeof nY === "undefined" || Number.isNaN(nY)) nY = nX;
9-
if (nX > 100) nX = 100;
10-
if (nY > 100) nY = 100;
11-
if (nX < 0.00000000001) nX = 0.00000000001;
12-
if (nY < 0.00000000001) nY = 0.00000000001;
13-
14-
const nX2 = 2 / nX;
15-
const nY2 = nY ? 2 / nY : nX2;
16-
const steps = 360;
17-
const step = (2 * Math.PI) / steps;
7+
if (Number.isNaN(nX)) nX = 4
8+
if (typeof nY === 'undefined' || Number.isNaN(nY)) nY = nX
9+
if (nX > 100) nX = 100
10+
if (nY > 100) nY = 100
11+
if (nX < 0.00000000001) nX = 0.00000000001
12+
if (nY < 0.00000000001) nY = 0.00000000001
13+
14+
const nX2 = 2 / nX
15+
const nY2 = nY ? 2 / nY : nX2
16+
const steps = 360
17+
const step = (2 * Math.PI) / steps
1818
const points = t => {
19-
const cosT = Math.cos(t);
20-
const sinT = Math.sin(t);
19+
const cosT = Math.cos(t)
20+
const sinT = Math.sin(t)
2121
return {
2222
x: Math.abs(cosT) ** nX2 * a * Math.sign(cosT),
2323
y: Math.abs(sinT) ** nY2 * b * Math.sign(sinT)
24-
};
25-
};
26-
return Array.from({ length: steps }, (_, i) => points(i * step));
24+
}
25+
}
26+
return Array.from({ length: steps }, (_, i) => points(i * step))
2727
}
2828

2929
paint(ctx, geom, properties) {
3030
const [nX, nY] = properties
31-
.get("--smooth-corners")
31+
.get('--smooth-corners')
3232
.toString()
33-
.replace(/ /g, "")
34-
.split(",");
33+
.replace(/ /g, '')
34+
.split(',')
3535

36-
const width = geom.width / 2;
37-
const height = geom.height / 2;
36+
const width = geom.width / 2
37+
const height = geom.height / 2
3838
const smooth = this.superellipse(
3939
width,
4040
height,
4141
parseFloat(nX),
4242
parseFloat(nY)
43-
);
43+
)
4444

45-
ctx.fillStyle = "#000";
46-
ctx.setTransform(1, 0, 0, 1, width, height);
47-
ctx.beginPath();
45+
ctx.fillStyle = '#000'
46+
ctx.setTransform(1, 0, 0, 1, width, height)
47+
ctx.beginPath()
4848

4949
for (let i = 0; i < smooth.length; i++) {
50-
const { x, y } = smooth[i];
51-
if (i === 0) ctx.moveTo(x, y);
52-
else ctx.lineTo(x, y);
50+
const { x, y } = smooth[i]
51+
if (i === 0) ctx.moveTo(x, y)
52+
else ctx.lineTo(x, y)
5353
}
5454

55-
ctx.closePath();
56-
ctx.fill();
55+
ctx.closePath()
56+
ctx.fill()
5757
}
5858
}
5959

6060
// eslint-disable-next-line no-undef
61-
registerPaint("smooth-corners", SmoothCornersPainter);
61+
registerPaint('smooth-corners', SmoothCornersPainter)

0 commit comments

Comments
 (0)