feat:实现已完成仿真之后直接调用波形预览组件展示波形预览图

This commit is contained in:
Roe-xin
2025-12-24 12:00:03 +08:00
parent 463eedf1dd
commit 9c787627a9
2 changed files with 66 additions and 1 deletions

View File

@ -484,9 +484,30 @@ export function getWebviewContent(iconUri?: string): string {
hideLoadingIndicator();
break;
case 'vcdInfo':
// 渲染迷你波形预览信息
try {
if (message.containerId && typeof renderWaveformInfo === 'function') {
renderWaveformInfo(message.containerId, message.vcdInfo || {});
}
} catch (e) {
console.warn('[WebView] 渲染波形信息失败:', e);
}
break;
case 'vcdGenerated':
// VCD 文件生成成功
// VCD 文件生成成功,添加消息并附带波形预览
addMessage(message.text, 'bot');
try {
if (message.vcdFilePath) {
const lastMsg = messagesEl ? messagesEl.lastElementChild : null;
if (lastMsg && typeof addWaveformPreviewToMessage === 'function') {
addWaveformPreviewToMessage(lastMsg, message.vcdFilePath, message.fileName || 'waveform.vcd');
}
}
} catch (e) {
console.warn('[WebView] 添加波形预览失败:', e);
}
break;
case 'fileContent':