import { BaseDrawService } from '../../../core/draw/baseDraw'; import type { PinyinDictationMode } from '../pinyinDictation.config'; import PinyinDictationSheetDraw from './PinyinDictationSheetDraw'; import PinyinDailyDraw from './PinyinDailyDraw'; export interface PinyinDictationData { mode: PinyinDictationMode; dayIndex?: number; } /** * 拼音听写/描红绘制分发层。 * 根据 data.mode 委托给对应的独立 DrawService 完成实际绘制。 */ export default class PinyinDictationDraw extends BaseDrawService { async draw(data: PinyinDictationData) { if (data.mode === 'pinyin-daily') { const delegate = new PinyinDailyDraw( this.canvas, this.ctx, this.options, ); await delegate.draw(data.dayIndex ?? 0); } else { const delegate = new PinyinDictationSheetDraw( this.canvas, this.ctx, this.options, ); await delegate.draw(data); } } }