解决没有考虑 gcd 导致跳转异常的问题

This commit is contained in:
锦恢 2024-09-11 13:43:11 +08:00
parent 802f95ab0a
commit 54f0c896a7
3 changed files with 10 additions and 3 deletions

View File

@ -17,7 +17,7 @@
<script>
window.readVcdFile = async () => {
const response = await fetch('FFT_IFFT.vcd');
const response = await fetch('test.vcd');
const blob = await response.blob();
const reader = new FileReader();
return new Promise((resolve, reject) => {

View File

@ -25,7 +25,7 @@ const props = defineProps({
});
const itemStyle = computed(() => ({
left: props.pivot.x - boxShift + 'px'
left: (props.pivot || { x: 0 }).x - boxShift + 'px'
}));
function makeDiffLabel() {
@ -34,7 +34,7 @@ function makeDiffLabel() {
const currentPivot = Id2Pivot.get(currentPivotId);
if (currentPivot) {
const t1 = cursorX2time(currentPivot.x);
const t2 = cursorX2time(props.pivot.x);
const t2 = cursorX2time((props.pivot || { x: 0 }).x);
const relativeTime = t2 - t1;
return formatTime(relativeTime, globalLookup.timescale);
}

View File

@ -2,6 +2,7 @@ import { reactive, ref } from "vue";
import { time2cursorX, SystemPivot } from "./cursor";
import { globalLookup } from "@/hook/global";
import formatTime from "@/hook/wave-view/format-time";
import { RelativeAxis } from './relative-axis';
/**
* @description 每一个动态信标
@ -82,6 +83,12 @@ export function deletePivot(time) {
UserPivots.delete(time);
Id2Pivot.delete(pivot.id);
UserPivotCtxShows.delete(pivot.id);
// 如果当前的删除的信标刚好是相对坐标轴的,那么把相对坐标轴也隐藏
if (RelativeAxis.show && RelativeAxis.currentPivotId === pivot.id) {
RelativeAxis.show = false;
currentPivotId.value = 0;
}
}
currentPivotId.value = 0;