feat:V2.5.2 图形符号配对
This commit is contained in:
@@ -146,4 +146,29 @@ export class BaseDrawService {
|
||||
|
||||
this.currentY = dividerY + 10; // 分割线下方10px间距
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制虚线分割线(逻辑像素,尺寸除以3)
|
||||
* @param y 分割线的Y坐标
|
||||
* @param margin 左右边距,默认为40
|
||||
* @param color 线条颜色,默认为'#999'
|
||||
* @param lineWidth 线条宽度,默认为1
|
||||
*/
|
||||
drawDashedDivider(
|
||||
y: number,
|
||||
margin: number = 40,
|
||||
color: string = '#999',
|
||||
lineWidth: number = 1,
|
||||
) {
|
||||
const { ctx, canvasWidth } = this;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = lineWidth;
|
||||
ctx.setLineDash([4, 4]); // 虚线
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(margin, y);
|
||||
ctx.lineTo(canvasWidth - margin, y);
|
||||
ctx.stroke();
|
||||
ctx.setLineDash([]); // 重置为实线
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user