Files
AFFiNE-Mirror/blocksuite/affine/gfx/shape/src/overlay/ellipse.ts
T
2025-03-21 06:13:11 +00:00

16 lines
484 B
TypeScript

import type { RoughCanvas } from '@blocksuite/affine-block-surface';
import { Shape } from './shape';
import { drawGeneralShape } from './utils';
export class EllipseShape extends Shape {
draw(ctx: CanvasRenderingContext2D, rc: RoughCanvas): void {
if (this.shapeStyle === 'Scribbled') {
const [x, y, w, h] = this.xywh;
rc.ellipse(x + w / 2, y + h / 2, w, h, this.options);
} else {
drawGeneralShape(ctx, 'ellipse', this.xywh, this.options);
}
}
}