antvis / Graphin

A React toolkit for graph visualization based on G6
https://graphin.antv.antgroup.com
MIT License
980 stars 263 forks source link

Tooltip positioning error in custom nodes #485

Closed AhmedSalihCezayir closed 11 months ago

AhmedSalihCezayir commented 1 year ago

Describe the bug

When a tooltip is added to a custom node, tooltip is not centered with respect to the node but instead it is in the wrong position.

Your Example Website or App

https://codesandbox.io/s/tooltip-location-problem-morw7v?file=/src/App.js

Steps to Reproduce the Bug or Issue

  1. Go to the sandbox that I provided.
  2. See the tooltip positioning problem.

Expected behavior

I expect the tooltip to be centered.

Screenshots or Videos

Current tooltip positioning: image

Platform

Additional context

No response

pomelo-nwu commented 11 months ago

@AhmedSalihCezayir Since the tooltip display position is the center of the default CircleNode:https://github.com/antvis/Graphin/blob/master/packages/graphin/src/components/Tooltip/useTooltip.tsx#L51

it is recommended that you customize a tooltip for this case