修复 【wave最大仿真时间的vcd更新了但view不更新】

This commit is contained in:
锦恢 2024-11-18 00:05:02 +08:00
parent c847eb5a83
commit afa5e8fb2b
3 changed files with 9 additions and 5 deletions

View File

@ -16,8 +16,8 @@
<script>
window.readVcdFile = async () => {
let inputVcdFile = 'test.vcd';
let inputViewFile = 'test.view';
let inputVcdFile = 'basic_tb.vcd';
let inputViewFile = 'basic_tb.view';
const response = await fetch(inputVcdFile);
const arrayBuffer = await response.arrayBuffer();
return [arrayBuffer, inputVcdFile, inputViewFile];

View File

@ -100,6 +100,7 @@ onMounted(async () => {
globalLookup.tgcd = workerVars.tgcd;
globalLookup.time = workerVars.time;
globalLookup.maxTime = globalLookup.time * globalLookup.tgcd;
globalLookup.chango = signalValues;
makeWaveView();

View File

@ -1,11 +1,14 @@
import { globalLookup } from "../global";
const xOffsetUpdate = (pstate, nextOffsetXFn) => {
let nextOffsetX = nextOffsetXFn();
const { width, xOffset, xScale, time, sidebarWidth } = pstate;
const maxTime = globalLookup.maxTime;
const maxOffsetX = width + xScale * time * 1.0; // maximum offset
const maxOffsetX = width + xScale * maxTime * 1.0; // maximum offset
nextOffsetX = Math.min(nextOffsetX, maxOffsetX);
const minOffsetX = - width - xScale * time * 1.2; // minimum offset
const minOffsetX = - width - xScale * maxTime * 1.0; // minimum offset
nextOffsetX = Math.max(nextOffsetX, minOffsetX);
// 检测 0 是否超出了左侧的 --sidebar-width 的位置