fix: 增加Peak Infomation操作红线时,自动聚焦图表,以让键盘事件生效

This commit is contained in:
Xu Zhimeng 2023-11-22 09:40:44 +08:00
parent f7d71f6a93
commit d5491bfcee

View File

@ -895,7 +895,7 @@ export default {
// 线
handleChartClick(param) {
this.$refs.chartContainerRef.focus()
this.focusChart()
const { offsetX, offsetY } = param
const point = getXAxisAndYAxisByPosition(this.getChart(), offsetX, offsetY)
if (point) {
@ -910,6 +910,11 @@ export default {
}
},
// keydown
focusChart() {
this.$refs.chartContainerRef.focus()
},
//
setChartBottomTitle(channel, energy, counts) {
const { index, find } = findNearPeak(channel, this.peakList)
@ -981,10 +986,13 @@ export default {
// peak info
handlePeakInfoChange(direction) {
this.moveMarkLine(direction)
this.focusChart()
},
// Peak Infomation
handleTogglePeak() {
this.focusChart()
const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
const xAxis = spectrumLineSeries.markLine.data[0].xAxis
const channel = this.isEnergy ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed())