feat:2.4.4 代码优化
This commit is contained in:
@@ -98,7 +98,6 @@ export class BaseMathDrawService {
|
||||
this.options.subTitle || '找一找下面相同的数字,涂上颜色',
|
||||
},
|
||||
onHeaderDrawn: (currentY) => {
|
||||
console.log('onHeaderDrawn currentY', currentY);
|
||||
this.currentY = currentY;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -65,8 +65,8 @@ export async function drawCompareContent({
|
||||
// 布局参数
|
||||
const leftMargin = 30;
|
||||
const rightMargin = 30;
|
||||
const topMargin = 20;
|
||||
const rowSpacing = 114; // 行之间的间距
|
||||
const topMargin = 12;
|
||||
const rowSpacing = 116; // 行之间的间距
|
||||
const columnSpacing = 40; // 两列之间的间距(可调节)
|
||||
|
||||
// 计算每列的宽度(减去边距和列间距)
|
||||
@@ -76,7 +76,7 @@ export async function drawCompareContent({
|
||||
|
||||
// 框的尺寸
|
||||
const boxWidth = 100;
|
||||
const boxHeight = 98;
|
||||
const boxHeight = 100;
|
||||
const borderRadius = 12;
|
||||
const circleRadius = 18; // 圆圈半径
|
||||
|
||||
@@ -98,11 +98,13 @@ export async function drawCompareContent({
|
||||
|
||||
let currentY = startY + topMargin;
|
||||
|
||||
// 计算分割线位置(两列中间)
|
||||
// const dividerX = leftMargin + columnWidth + columnSpacing / 2;
|
||||
|
||||
// 固定绘制6行
|
||||
const totalRows = 6;
|
||||
for (let rowIndex = 0; rowIndex < totalRows; rowIndex++) {
|
||||
const rowY = currentY + rowIndex * rowSpacing;
|
||||
|
||||
// 绘制左侧列
|
||||
const leftProblemIndex = rowIndex * 2;
|
||||
if (leftProblemIndex < problems.length) {
|
||||
@@ -137,6 +139,18 @@ export async function drawCompareContent({
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 绘制中间分割线(贯穿所有行)
|
||||
// if (totalRows > 0) {
|
||||
// ctx.strokeStyle = '#999';
|
||||
// ctx.lineWidth = 1;
|
||||
// ctx.beginPath();
|
||||
// const dividerStartY = currentY;
|
||||
// const dividerEndY = currentY + (totalRows - 1) * rowSpacing + boxHeight;
|
||||
// ctx.moveTo(dividerX, dividerStartY);
|
||||
// ctx.lineTo(dividerX, dividerEndY);
|
||||
// ctx.stroke();
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user