antvis/G6

缩小和放大画布会导致tooltip的定位发生偏移 #5126

zyh0yh posted onGitHub

Describe the bug

缩小和放大画布会导致tooltip的定位发生偏移

Your Example Website or App

https://g6-next.antv.antgroup.com/examples/tool/tooltip/#tooltipPlugin

Steps to Reproduce the Bug or Issue

1.打开5.0示例文档中提示框示例 2.在 modes配置中增加 'zoom-canvas','drag-canvas',使示例可缩放和拖拽 3.先不进行任何操作,将鼠标移入节点查看和记录tooltip的postion位置 4.进行缩放,再次鼠标移入节点查看和记录tooltip的postion位置

Expected behavior

tooltip 的 fixtoNode 可以不受画布缩放和拖拽的影响,更灵活的配置,并且希望增加一个topcenter,center等 定位参数

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [5.0.0-beta.27]

Additional context

No response


Hi @zyh0yh, Please star this repo if you find it useful! Thanks :star:! 你好 @zyh0yh。如果该仓库对你有用,可以 star 一下,感谢你的 :star:!

posted by github-actions[bot] over 1 year ago

遇到了相似的问题,G6.TreeGraph changeSize api调用后,Tooltip的offset发生偏差,鼠标直接出现在了Tooltip里,导致鼠标一致悬停tooltip不再自动隐藏

posted by fatyrify over 1 year 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

我也遇到了,你们怎么解决的

posted by mxluomx 9 months ago

我也遇到了,你们怎么解决的

1:定义个ref const tooltipRef = useRef(null);

2:将你的插件赋值以便于后面使用 const tooltip = tooltipFn(); tooltipRef.current = tooltip;

3:在node:mouseenter事件上监听,动态改变 tooltip的offsetX和offsetY graph.on('node:mouseenter', (evt) => { const graph = graphRef.current; const zoom = graph.getZoom(); tooltipRef.current._cfgs.offsetX = -(36 * zoom); tooltipRef.current._cfgs.offsetY = 38 * zoom; });

posted by unclepan about 1 month ago

Fund this Issue

$0.00
Funded

Pull requests