diff --git a/desktop/src/components/classroom_player/SceneRenderer.tsx b/desktop/src/components/classroom_player/SceneRenderer.tsx index c5fda5b..3543db0 100644 --- a/desktop/src/components/classroom_player/SceneRenderer.tsx +++ b/desktop/src/components/classroom_player/SceneRenderer.tsx @@ -7,6 +7,7 @@ import { useState, useEffect, useCallback } from 'react'; import type { GeneratedScene, SceneContent, SceneAction, AgentProfile } from '../../types/classroom'; +import { WhiteboardCanvas } from './WhiteboardCanvas'; interface SceneRendererProps { scene: GeneratedScene; @@ -79,12 +80,8 @@ export function SceneRenderer({ scene, agents, autoPlay = true }: SceneRendererP {/* Whiteboard area */} {whiteboardItems.length > 0 && ( -
- - {whiteboardItems.map((item, i) => ( - {renderWhiteboardItem(item)} - ))} - +
+
)}
@@ -127,6 +124,9 @@ function getActionDelay(action: SceneAction): number { case 'speech': return 2000; case 'whiteboard_draw_text': return 800; case 'whiteboard_draw_shape': return 600; + case 'whiteboard_draw_chart': return 1000; + case 'whiteboard_draw_latex': return 1000; + case 'whiteboard_clear': return 300; case 'quiz_show': return 5000; case 'discussion': return 10000; default: return 1000; @@ -190,30 +190,3 @@ function renderCurrentAction(action: SceneAction, agents: AgentProfile[]) { } } - -function renderWhiteboardItem(item: { type: string; data: Record }) { - switch (item.type) { - case 'whiteboard_draw_text': { - const d = item.data; - if ('text' in d && 'x' in d && 'y' in d) { - return ( - - {String(d.text ?? '')} - - ); - } - return null; - } - case 'whiteboard_draw_shape': { - const d = item.data as Record; - const x = typeof d.x === 'number' ? d.x : 0; - const y = typeof d.y === 'number' ? d.y : 0; - const w = typeof d.width === 'number' ? d.width : 100; - const h = typeof d.height === 'number' ? d.height : 50; - const fill = typeof d.fill === 'string' ? d.fill : '#e5e5e5'; - return ( - - ); - } - } -} diff --git a/docs/features/classroom/WHITEBOARD_UNIFICATION_PLAN.md b/docs/features/classroom/WHITEBOARD_UNIFICATION_PLAN.md index 96bd52d..f293455 100644 --- a/docs/features/classroom/WHITEBOARD_UNIFICATION_PLAN.md +++ b/docs/features/classroom/WHITEBOARD_UNIFICATION_PLAN.md @@ -1,6 +1,6 @@ # P3-02: 白板统一渲染方案 -> **状态**: 方案已制定,待新会话推进实现 +> **状态**: ✅ 已完成 (2026-04-06) > **优先级**: P3 (非阻塞) > **依赖**: ClassroomPlayer 重构 @@ -50,11 +50,12 @@ SceneRenderer 的 `processAction()` 产出的 `{ type, data: SceneAction }` 格 #### Step 4: 验证 -- [ ] ClassroomPlayer 中白板绘制正常(text/shape) -- [ ] Chart 渲染正常(bar/line) -- [ ] LaTeX 渲染正常 -- [ ] 自动推进动作序列正常 -- [ ] 白板清空 (`whiteboard_clear`) 正常 +- [x] ClassroomPlayer 中白板绘制正常(text/shape) +- [x] Chart 渲染正常(bar/line) +- [x] LaTeX 渲染正常 +- [x] 自动推进动作序列正常 +- [x] 白板清空 (`whiteboard_clear`) 正常 +- [x] TypeScript 类型检查通过 ## 3. 影响范围