fix: 修复示波器停止捕获导致无法配置的问题,并取消示波器动画
This commit is contained in:
parent
1ce12120a0
commit
f9178784c3
|
@ -262,16 +262,11 @@ const [useProvideOscilloscope, useOscilloscopeState] = createInjectionState(() =
|
||||||
alert.success("测试数据生成成功", 2000);
|
alert.success("测试数据生成成功", 2000);
|
||||||
};
|
};
|
||||||
|
|
||||||
const isOperationInProgress = computed(
|
|
||||||
() => isApplying.value || isCapturing.value || operationMutex.isLocked()
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
oscData,
|
oscData,
|
||||||
config,
|
config,
|
||||||
isApplying,
|
isApplying,
|
||||||
isCapturing,
|
isCapturing,
|
||||||
isOperationInProgress,
|
|
||||||
sampleCount,
|
sampleCount,
|
||||||
samplePeriodNs,
|
samplePeriodNs,
|
||||||
refreshIntervalMs,
|
refreshIntervalMs,
|
||||||
|
|
|
@ -104,9 +104,11 @@ const option = computed((): EChartsOption => {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isCapturing = oscManager.isCapturing.value;
|
||||||
|
|
||||||
const series: LineSeriesOption[] = [];
|
const series: LineSeriesOption[] = [];
|
||||||
|
|
||||||
// 兼容单通道和多通道,确保 yChannels 为 number[][]
|
// 兼容单通道和多通道,确保 yChannels 为 number[]
|
||||||
const yChannels: number[][] = Array.isArray(oscData.value.y[0])
|
const yChannels: number[][] = Array.isArray(oscData.value.y[0])
|
||||||
? (oscData.value.y as number[][])
|
? (oscData.value.y as number[][])
|
||||||
: [oscData.value.y as number[]];
|
: [oscData.value.y as number[]];
|
||||||
|
@ -126,6 +128,10 @@ const option = computed((): EChartsOption => {
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
width: 2,
|
width: 2,
|
||||||
},
|
},
|
||||||
|
// 关闭系列动画
|
||||||
|
animation: !isCapturing,
|
||||||
|
animationDuration: isCapturing ? 0 : 1000,
|
||||||
|
animationEasing: isCapturing ? "linear" : "cubicOut",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -157,7 +163,7 @@ const option = computed((): EChartsOption => {
|
||||||
saveAsImage: {},
|
saveAsImage: {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dataZoom: (oscManager.isCapturing.value) ? [] : [
|
dataZoom: [
|
||||||
{
|
{
|
||||||
type: "inside",
|
type: "inside",
|
||||||
start: 0,
|
start: 0,
|
||||||
|
@ -198,6 +204,10 @@ const option = computed((): EChartsOption => {
|
||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// 全局动画开关
|
||||||
|
animation: !isCapturing,
|
||||||
|
animationDuration: isCapturing ? 0 : 1000,
|
||||||
|
animationEasing: isCapturing ? "linear" : "cubicOut",
|
||||||
series: series,
|
series: series,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -77,14 +77,14 @@
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<button class="btn btn-primary" type="submit" :disabled="osc.isOperationInProgress.value">
|
<button class="btn btn-primary" type="submit" :disabled="osc.isApplying.value || osc.isCapturing.value">
|
||||||
应用配置
|
应用配置
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-secondary" type="button" @click="osc.resetConfiguration"
|
<button class="btn btn-secondary" type="button" @click="osc.resetConfiguration"
|
||||||
:disabled="osc.isOperationInProgress.value">
|
:disabled="osc.isApplying.value || osc.isCapturing.value">
|
||||||
重置
|
重置
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-outline" @click="osc.refreshRAM" :disabled="osc.isOperationInProgress.value">
|
<button class="btn btn-outline" @click="osc.refreshRAM" :disabled="osc.isApplying.value || osc.isCapturing.value">
|
||||||
刷新RAM
|
刷新RAM
|
||||||
</button>
|
</button>
|
||||||
<!-- <button class="btn btn-accent" @click="osc.generateTestData" :disabled="osc.isOperationInProgress.value">
|
<!-- <button class="btn btn-accent" @click="osc.generateTestData" :disabled="osc.isOperationInProgress.value">
|
||||||
|
|
Loading…
Reference in New Issue