fix: 增加Peak Infomation操作红线时,自动聚焦图表,以让键盘事件生效
This commit is contained in:
parent
f7d71f6a93
commit
d5491bfcee
|
@ -895,7 +895,7 @@ export default {
|
||||||
|
|
||||||
// 点击图表,设置红线
|
// 点击图表,设置红线
|
||||||
handleChartClick(param) {
|
handleChartClick(param) {
|
||||||
this.$refs.chartContainerRef.focus()
|
this.focusChart()
|
||||||
const { offsetX, offsetY } = param
|
const { offsetX, offsetY } = param
|
||||||
const point = getXAxisAndYAxisByPosition(this.getChart(), offsetX, offsetY)
|
const point = getXAxisAndYAxisByPosition(this.getChart(), offsetX, offsetY)
|
||||||
if (point) {
|
if (point) {
|
||||||
|
@ -910,6 +910,11 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 聚焦图表容器,以接收keydown事件
|
||||||
|
focusChart() {
|
||||||
|
this.$refs.chartContainerRef.focus()
|
||||||
|
},
|
||||||
|
|
||||||
// 设置图表底部的标题
|
// 设置图表底部的标题
|
||||||
setChartBottomTitle(channel, energy, counts) {
|
setChartBottomTitle(channel, energy, counts) {
|
||||||
const { index, find } = findNearPeak(channel, this.peakList)
|
const { index, find } = findNearPeak(channel, this.peakList)
|
||||||
|
@ -981,10 +986,13 @@ export default {
|
||||||
// peak info 点击左右方向
|
// peak info 点击左右方向
|
||||||
handlePeakInfoChange(direction) {
|
handlePeakInfoChange(direction) {
|
||||||
this.moveMarkLine(direction)
|
this.moveMarkLine(direction)
|
||||||
|
this.focusChart()
|
||||||
},
|
},
|
||||||
|
|
||||||
// 触发Peak Infomation
|
// 触发Peak Infomation
|
||||||
handleTogglePeak() {
|
handleTogglePeak() {
|
||||||
|
this.focusChart()
|
||||||
|
|
||||||
const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
|
const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
|
||||||
const xAxis = spectrumLineSeries.markLine.data[0].xAxis
|
const xAxis = spectrumLineSeries.markLine.data[0].xAxis
|
||||||
const channel = this.isEnergy ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed())
|
const channel = this.isEnergy ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user