@visactor/vrender-core
Version:
## Description
33 lines (26 loc) • 901 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.LineHSymbol = exports.lineH = void 0;
const base_1 = require("./base");
function lineH(ctx, r, x, y, z) {
return ctx.moveTo(x - r, y), ctx.lineTo(x + r, y), !0;
}
exports.lineH = lineH;
class LineHSymbol extends base_1.BaseSymbol {
constructor() {
super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
}
draw(ctx, size, x, y, z) {
return lineH(ctx, this.parseSize(size) / 2, x, y, z);
}
drawOffset(ctx, size, x, y, offset, z) {
return lineH(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} L ${x + r},${y}`;
}
}
exports.LineHSymbol = LineHSymbol, exports.default = new LineHSymbol;
//# sourceMappingURL=line-h.js.map