feat:V2.5.3 修改下载分享弹窗问题、新增连连看
This commit is contained in:
@@ -217,4 +217,69 @@ export class BaseDrawService {
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制圆角矩形框(逻辑像素,尺寸除以3)
|
||||
* @param x 框的X坐标
|
||||
* @param y 框的Y坐标
|
||||
* @param width 框的宽度
|
||||
* @param height 框的高度
|
||||
* @param options 可选参数
|
||||
* @param options.isDashed 是否为虚线,默认为false(实线)
|
||||
* @param options.radius 圆角半径,默认为10
|
||||
* @param options.color 线条颜色,默认为'#000'
|
||||
* @param options.lineWidth 线条宽度,默认为1
|
||||
*/
|
||||
drawRoundedRect(
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
options?: {
|
||||
isDashed?: boolean;
|
||||
radius?: number;
|
||||
color?: string;
|
||||
lineWidth?: number;
|
||||
},
|
||||
): void {
|
||||
const { ctx } = this;
|
||||
const {
|
||||
isDashed = false,
|
||||
radius = 10,
|
||||
color = '#000',
|
||||
lineWidth = 1,
|
||||
} = options || {};
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = lineWidth;
|
||||
|
||||
// 设置虚线或实线
|
||||
if (isDashed) {
|
||||
ctx.setLineDash([4, 4]); // 虚线
|
||||
} else {
|
||||
ctx.setLineDash([]); // 实线
|
||||
}
|
||||
|
||||
// 绘制圆角矩形
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x + radius, y);
|
||||
ctx.lineTo(x + width - radius, y);
|
||||
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
|
||||
ctx.lineTo(x + width, y + height - radius);
|
||||
ctx.quadraticCurveTo(
|
||||
x + width,
|
||||
y + height,
|
||||
x + width - radius,
|
||||
y + height,
|
||||
);
|
||||
ctx.lineTo(x + radius, y + height);
|
||||
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
|
||||
ctx.lineTo(x, y + radius);
|
||||
ctx.quadraticCurveTo(x, y, x + radius, y);
|
||||
ctx.closePath();
|
||||
ctx.stroke();
|
||||
|
||||
// 重置为实线(避免影响后续绘制)
|
||||
ctx.setLineDash([]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user