Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 透视表角头单元格使用showTooltip方法显示Tooltip后,鼠标划到其他地方Tooltip会马上消失,不符合预期 #2496

Closed
thislucky opened this issue Jan 3, 2024 · 2 comments

Comments

@thislucky
Copy link

🏷 Version 1.54.2

Package Version
@antv/s2 1.54.2
@antv/s2-react 1.46.0
@antv/s2-vue -

-->

Package Version
@antv/s2 1.54.2
@antv/s2-react 1.46.0
@antv/s2-vue

Sheet Type

SheetComponent

🖋 Description

透视表角头单元格使用onCornerCellClick方法监听后使用showTooltip方法显示Tooltip后,鼠标划到其他任意地方Tooltip会马上消失,不符合预期

https://s2.antv.antgroup.com/zh/examples/react-component/tooltip/#custom-click-show-tooltip
<SheetComponent
sheetType="pivot"
adaptive={false}
dataCfg={dataCfg}
options={s2Options}
onColCellClick={onColCellClick}
onCornerCellClick={onColCellClick} //这里
/>

🔗 Reproduce Link

🤔 Steps to Reproduce

官网示例添加onCornerCellClick={onColCellClick}这行代码就可以复现,但是如果有Tooltip显示的情况下,点击角头出现的Tooltip不会出现这样的问题,如果当前没有Tooltip显示点击角头出现的Tooltip就会出现这个问题

😊 Expected Behavior

预期需要和其他单元格的Tooltip显示效果一样,不能鼠标一动Tooltip就消失

😅 Current Behavior

💻 System information

Environment Info
System
Browser
@thislucky
Copy link
Author

@lijinke666 大佬,可以加急帮忙看下嘛,十分感谢

@lijinke666
Copy link
Member

tooltip 只有在单元格选中状态下, hover 才不会消失, 你这里的场景是给角头增加了自定义 tooltip, 但是不是选中状态, 所以会消失, 解决办法是 tooltip 展示后增加一个 hover 拦截

s2.showTooltip()
s2.interaction.addIntercepts(['hover'])

tooltip 关闭后记得移除

s2.interaction.removeIntercepts(['hover'])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants