Eliav2 / react-xarrows

Draw arrows (or lines) between components in React!
https://codesandbox.io/embed/github/Eliav2/react-xarrows/tree/master/examples?fontsize=14&hidenavigation=1&theme=dark
MIT License
584 stars 75 forks source link

scaling arrows #94

Open james-hafer opened 3 years ago

james-hafer commented 3 years ago

Awesome work, this is extremely easy to use!

When allowing end users to zoom in and out by using transform: 'scale(.8)' for example, the lines cannot find the nodes properly.

Using your example on code sandbox, if you update canvas style to be this when on 'FewArrows' you can reproduce the issue. export const canvasStyle = { width: '100%', height: '40vh', background: 'white', overflow: 'auto', display: 'flex', pointerEvents: 'none', transform: 'scale(.8)', };

image

Eliav2 commented 3 years ago

I see this issue always comes back... this is easy to fix, but this is a quite common issue so I consider adding 'scale' property to the API as scaling is a common use case. it will take time as the entire lib is rewritten to me much modular, so for now, please see #68 or #30. this should help you for now. (use SVGcanvasStyle={{transform: `scale(${1 / scale})`}} )

i will leave this open until next release

james-hafer commented 3 years ago

Awesome, that does the trick, thank you!