@visactor/vrender-core
Version:
## Description
33 lines (26 loc) • 989 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.DiamondSymbol = exports.diamond = void 0;
const base_1 = require("./base");
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;
}
exports.diamond = diamond;
class DiamondSymbol extends base_1.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);
}
}
exports.DiamondSymbol = DiamondSymbol, exports.default = new DiamondSymbol;
//# sourceMappingURL=diamond.js.map