feat: 绘制基础类重构
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
/**
|
||||
* 田字格练字服务
|
||||
* 根据汉字列表绘制到Canvas
|
||||
*
|
||||
* 支持的汉字类型:
|
||||
* - character:汉字
|
||||
* - number:数字
|
||||
* - letter:字母
|
||||
* - symbol:符号
|
||||
*/
|
||||
import { BaseDrawService } from '../core/draw/baseDraw';
|
||||
import { CharacterItem } from '../types/characterType';
|
||||
|
||||
@@ -255,32 +265,28 @@ class WordDrawService extends BaseDrawService {
|
||||
this.clear();
|
||||
this.setPaper();
|
||||
|
||||
// 绘制Header
|
||||
if (this.headerType !== 'minimal') {
|
||||
await this.drawHeader();
|
||||
} else {
|
||||
this.drawMiniHeader();
|
||||
}
|
||||
|
||||
await this.drawHeader();
|
||||
this.drawDivider();
|
||||
this.drawContentEmpty();
|
||||
await this.drawContentEmpty();
|
||||
}
|
||||
|
||||
async drawContentEmpty() {
|
||||
this.clearContentArea();
|
||||
this.drawContent(null);
|
||||
await this.drawPrintFooter();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制田字格和练字内容
|
||||
* @param wordsMap 形如 { "其": ["M.. L.. Z", ...], ... },不超过 10 个汉字
|
||||
*/
|
||||
drawPracticeContent(characters: CharacterItem[]) {
|
||||
async drawPracticeContent(characters: CharacterItem[]) {
|
||||
// 清空内容区域(页眉以下的部分)
|
||||
this.clearContentArea();
|
||||
|
||||
// 绘制田字格和练字内容
|
||||
this.drawContent(characters);
|
||||
await this.drawPrintFooter();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user