Merge remote-tracking branch 'upstream/main'

This commit is contained in:
2026-08-26 09:31:34 +08:00
parent 9b8c4bfab6
commit 394eb0285d
34137 changed files with 3589424 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
/**
* 圆形
*/
import Path, { PathProps } from '../Path';
export class CircleShape {
cx = 0
cy = 0
r = 0
}
export interface CircleProps extends PathProps {
shape?: Partial<CircleShape>
}
class Circle extends Path<CircleProps> {
shape: CircleShape
constructor(opts?: CircleProps) {
super(opts);
}
getDefaultShape() {
return new CircleShape();
}
buildPath(ctx: CanvasRenderingContext2D, shape: CircleShape) {
// Use moveTo to start a new sub path.
// Or it will be connected to other subpaths when in CompoundPath
ctx.moveTo(shape.cx + shape.r, shape.cy);
ctx.arc(shape.cx, shape.cy, shape.r, 0, Math.PI * 2);
}
};
Circle.prototype.type = 'circle';
export default Circle;