The issue has been closed
问题描述
tooltip 在有滚动条的时候显示位置不准确
重现链接
无
重现步骤
无
预期行为
tooltip 在滚动的前提下也能正常显示
平台
- 操作系统: [macOS, Windows, Linux, React Native ...]
- 网页浏览器: [Google Chrome, Safari, Firefox]
- G6 版本: [4.5.1 ... ]
屏幕截图或视频(可选)

箭头处为设置的tooltip显示位置 当滚动条滚动时 tooltip位置发生偏移 滚动条滚动距离大 tooltip不显示(应该是便宜位置远着不着了)

补充说明(可选)
No response

posted by icemanjin almost 2 years ago 
const jtoolTip:= document.createElement('div')
jtoolTip.classList.add('g6-component-tooltip')
const tipContainer = document.querySelector('#drag')
graph.value.on('node:mouseover', (evt: any) => {
const { item } = evt
const model = item.getModel()
const zoom = graph.value.getZoom()
const canvas = graph.value.get('canvas')
const canvasBBox = canvas.getCanvasBBox()
const canvasLeft = canvasBBox.minX
const canvasTop = canvasBBox.minY
jtoolTip.innerHTML = model.name
jtoolTip.style.position = 'absolute'
jtoolTip.style.top = (evt.clientY + canvasTop - 8) * zoom + 'px'
jtoolTip.style.left =
(canvasLeft + model.x + model.size[0] + 6) * zoom + 'px'
if (tipContainer.childNodes.length <= 1) {
tipContainer.appendChild(jtoolTip)
} else {
jtoolTip.style.display = ''
}
})
// 监听鼠标离开节点事件
graph.value.on('node:mouseout', () => {
jtoolTip.style.display = 'none'
})
可以先这样处理
posted by icemanjin almost 2 years ago
posted by Yanyan-Wang almost 2 years ago 
This issue has been closed because it has been outdate for a long time.
Please open a new issue if you still need help.
这个 issue 已经被关闭,因为 它已经过期很久了。
如果你仍然需要帮助,请创建一个新的 issue。
posted by github-actions[bot] 10 months ago