UNPKG

@visactor/vrender-core

Version:
34 lines (27 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.CloseSymbol = exports.close = void 0; const base_1 = require("./base"); function close(ctx, r, x, y, z) { return ctx.moveTo(x - r, y - r), ctx.lineTo(x + r, y + r), ctx.moveTo(x + r, y - r), ctx.lineTo(x - r, y + r), !0; } exports.close = close; class CloseSymbol extends base_1.BaseSymbol { constructor() { super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"; } draw(ctx, size, x, y, z) { return close(ctx, this.parseSize(size) / 2, x, y, z); } drawOffset(ctx, size, x, y, offset, z) { return close(ctx, this.parseSize(size) / 2 + offset, x, y, z); } drawToSvgPath(size, x, y, z) { const r = this.parseSize(size) / 2; return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`; } } exports.CloseSymbol = CloseSymbol, exports.default = new CloseSymbol; //# sourceMappingURL=close.js.map