UNPKG

@visactor/vrender-core

Version:

```typescript import { xxx } from '@visactor/vrender-core'; ```

25 lines (21 loc) 798 B
import { BaseSymbol } from "./base"; export function diamond(ctx, r, x, y, z) { return ctx.moveTo(x, y - r, z), ctx.lineTo(r + x, y, z), ctx.lineTo(x, y + r, z), ctx.lineTo(x - r, y, z), ctx.closePath(), !0; } export class DiamondSymbol extends BaseSymbol { constructor() { super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z"; } draw(ctx, size, x, y, z) { return diamond(ctx, this.parseSize(size) / 2, x, y, z); } drawFitDir(ctx, size, x, y, z) { return diamond(ctx, this.parseSize(size) / 2, x, y, z); } drawOffset(ctx, size, x, y, offset, z) { return diamond(ctx, this.parseSize(size) / 2 + offset, x, y, z); } } export default new DiamondSymbol; //# sourceMappingURL=diamond.js.map