visjs / vis-network

:dizzy: Display dynamic, automatically organised, customizable network views.
https://visjs.github.io/vis-network/
Apache License 2.0
3.04k stars 371 forks source link

node DOM coordinate and canvas coordinate are different #499

Open FanJiaqing92 opened 4 years ago

FanJiaqing92 commented 4 years ago

I find node DOM coordinate and canvas coordinate are different in vis-network. There are 4 nodes in diagram A. Then remove one node and make diagram B with the same options as well as A. The 3 nodes' location in diagram B are different with the 3 nodes in diagram A. I find they have the same canvas coordinate and diffrent DOM coordinate. I want they have the same DOM coordinate as well as canvas. There is a demo. When right click the diagram, delete a node. Remaining nodes' locations change. <!doctype html>

Network
FanJiaqing92 commented 4 years ago

Anybody could help me?

Tyler-Maclachlan commented 4 years ago

The DOM and Canvas coordinates will always be different as the canvas keeps it's own screen space.

There are methods that allow for you to convert between the two.