UNPKG

@visactor/vrender-core

Version:

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

34 lines (27 loc) 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.ArrowSymbol = exports.arrow = void 0; const vutils_1 = require("@visactor/vutils"), base_1 = require("./base"), sqrt3 = (0, vutils_1.sqrt)(3); function arrow(ctx, r, transX, transY) { const triangleH = r, trangleBottomSide = triangleH / sqrt3, rectW = trangleBottomSide / 5, rectH = r; return ctx.moveTo(0 + transX, -triangleH + transY), ctx.lineTo(trangleBottomSide / 2 + transX, transY), ctx.lineTo(rectW / 2 + transX, transY), ctx.lineTo(rectW / 2 + transX, rectH + transY), ctx.lineTo(-rectW / 2 + transX, rectH + transY), ctx.lineTo(-rectW / 2 + transX, transY), ctx.lineTo(-trangleBottomSide / 2 + transX, transY), ctx.closePath(), !0; } exports.arrow = arrow; class ArrowSymbol extends base_1.BaseSymbol { constructor() { super(...arguments), this.type = "arrow", this.pathStr = "M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"; } draw(ctx, size, transX, transY) { return arrow(ctx, this.parseSize(size) / 2, transX, transY); } drawOffset(ctx, size, transX, transY, offset) { return arrow(ctx, this.parseSize(size) / 2 + offset, transX, transY); } } exports.ArrowSymbol = ArrowSymbol, exports.default = new ArrowSymbol; //# sourceMappingURL=arrow.js.map