NEZ-3409 fix: dashboard snapshot tooltip z-index 错误

This commit is contained in:
zyh
2024-02-07 10:29:10 +08:00
parent 3fa8f37844
commit ed7bce9b80
2 changed files with 10 additions and 6 deletions

View File

@@ -538,7 +538,7 @@ td .nz-icon-gear:before {
position: absolute; position: absolute;
} }
.chart-time-series-tooltip { .chart-time-series-tooltip {
position: absolute; position: fixed;
display: block; display: block;
border-style: solid; border-style: solid;
white-space: nowrap; white-space: nowrap;

View File

@@ -221,15 +221,15 @@ export default {
let x = 0 let x = 0
let y = 0 let y = 0
if (self.mousePosition.left < (windowWidth / 2)) { // 说明鼠标在左边放不下提示框 if (self.mousePosition.left < (windowWidth / 2)) { // 说明鼠标在左边放不下提示框
tooltip.style.left = (tooltipLeftOffset + lft + shiftX) + 'px' tooltip.style.left = (self.mousePosition.left + shiftX) + 'px'
} else { } else {
tooltip.style.left = (tooltipLeftOffset + lft - shiftX) + 'px' tooltip.style.left = (self.mousePosition.left - shiftX) + 'px'
x = '-100%' x = '-100%'
} }
if (self.mousePosition.top + 50 < windowHeight / 2) { // 说明鼠标上面放不下提示框 if (self.mousePosition.top + 50 < windowHeight / 2) { // 说明鼠标上面放不下提示框
tooltip.style.top = (tooltipTopOffset + top + shiftY) + 'px' tooltip.style.top = (self.mousePosition.top + shiftY) + 'px'
} else { } else {
tooltip.style.top = (tooltipTopOffset + top - shiftY) + 'px' tooltip.style.top = (self.mousePosition.top - shiftY) + 'px'
y = '-100%' y = '-100%'
} }
tooltip.style.transform = `translate(${x},${y})` tooltip.style.transform = `translate(${x},${y})`
@@ -558,7 +558,7 @@ export default {
} }
} }
}, },
uplotMouseenter () { uplotMouseenter (e) {
const chart = getChart(this.chartId) const chart = getChart(this.chartId)
const over = chart.over const over = chart.over
const root = chart.root.querySelector('.u-wrap') const root = chart.root.querySelector('.u-wrap')
@@ -567,6 +567,10 @@ export default {
tooltip = tooltip[0] tooltip = tooltip[0]
// tooltip.style.display = 'block' // tooltip.style.display = 'block'
} }
this.mousePosition = {
left: e.pageX,
top: e.pageY
}
over.addEventListener('mouseleave', this.uplotMouseleave) over.addEventListener('mouseleave', this.uplotMouseleave)
over.addEventListener('mousemove', this.uplotMousemove) over.addEventListener('mousemove', this.uplotMousemove)
over.addEventListener('mousedown', this.uplotMousedown) over.addEventListener('mousedown', this.uplotMousedown)