feat:添加按数字涂颜色

This commit is contained in:
R524809
2025-12-02 11:34:08 +08:00
parent 698109e6f5
commit 425eccea21
52 changed files with 1446 additions and 65 deletions
@@ -52,9 +52,6 @@ export class BaseMathDrawService {
const { ctx, canvas } = this;
const { pixelRatio: dpr } = wx.getWindowInfo();
let { width, height } = PAPER_SIZE[this.paperSize];
console.log('width', width);
console.log('height', height);
console.log('dpr', dpr);
this.canvasWidth = width;
this.canvasHeight = height;
@@ -87,8 +84,8 @@ export class BaseMathDrawService {
* 绘制Header(逻辑像素,尺寸除以3)
*/
async drawHeader() {
this.currentX = 24;
this.currentY = 24;
this.currentX = 25;
this.currentY = 25;
await drawMathHeader({
canvas: this.canvas,
ctx: this.ctx,
@@ -101,6 +98,7 @@ export class BaseMathDrawService {
this.options.subTitle || '找一找下面相同的数字,涂上颜色',
},
onHeaderDrawn: (currentY) => {
console.log('onHeaderDrawn currentY', currentY);
this.currentY = currentY;
},
});
@@ -118,6 +116,7 @@ export class BaseMathDrawService {
title: this.options.title || '看数字,涂一涂',
},
onHeaderDrawn: (currentY) => {
console.log('drawMiniHeader currentY', currentY);
this.currentY = currentY;
},
});
@@ -128,7 +127,7 @@ export class BaseMathDrawService {
*/
drawDivider() {
const { ctx, canvasWidth } = this;
const dividerY = this.currentY + 10; // 10px间距
const dividerY = this.currentY;
ctx.strokeStyle = '#000';
ctx.lineWidth = 1;