如图:我想这个线条后面的尾部这段截取,这个应该怎么画,目前只前面少一段长度画了。主要代码:
class CrossLineCellType extends GSSSheets.CellTypes.Text {
constructor() {
super()
this.typeName = "CrossLineCellType";
}
paint(ctx, value, x, y, w, h, style, options) {
if(value === "\\-"){
let start=35//这里主要是前面一节的处理,但是后面一节怎么去掉不知道怎么处理。
x = x +start
w = w -start
ctx.save();
ctx.beginPath();
ctx.moveTo(x, y + h / 4 - 1);
ctx.lineTo(x + w, y + h / 4 - 1);
ctx.lineTo(x + w, y + h / 4 );
ctx.lineTo(x, y + h / 4 );
ctx.lineTo(x, y + h / 4 - 1);
ctx.fillStyle = foreColor;
ctx.fill();
ctx.closePath();
ctx.restore();
value = null;
GSSSheets.CellTypes.Text.prototype.paint.apply(this, [ctx, value, x, y, w, h, style, options]);
}
}
}
|