Files
doodle-mini/miniprogram/englishPages/shared/draw/letterTracingDraw.ts
T
2026-04-17 17:03:36 +08:00

25 lines
972 B
TypeScript

import { BaseDrawService } from '../../../core/draw/baseDraw';
import type { LetterTracingData } from '../generators/letter-tracing-generator';
import singleLetterDraw from './singleLetterDraw';
import CasePairingDraw from './casePairingDraw';
import TwoColumnDraw from './twoColumnDraw';
import UpperLowerDraw from './upperLowerDraw';
/**
* 字母描红绘制分发层。
* 根据 data.mode 委托给对应的独立 DrawService 完成实际绘制。
*/
export default class LetterTracingDraw extends BaseDrawService {
async draw(data: LetterTracingData) {
const DrawClass = {
'letter-tracing-single': singleLetterDraw,
'letter-tracing-upper-lower': UpperLowerDraw,
'letter-tracing-case-pairing': CasePairingDraw,
'letter-tracing-two-column': TwoColumnDraw,
}[data.mode];
const delegate = new DrawClass(this.canvas, this.ctx, this.options);
await delegate.draw(data as any);
}
}