microsoft / automatic-graph-layout

A set of tools for graph layout and viewing
Other
1.35k stars 302 forks source link

How to "sync" two GraphViewers #298

Open NiklasVJM opened 2 years ago

NiklasVJM commented 2 years ago

Hi!

I have project, with two DockPanels on top of each others (and I have bound GraphViewers to both of them), on the same window, and I have two separate GraphViewers, one in each of them (and I have bound GraphViewers to both of DockPanels them). I'm currently drawing stuff on both of them, one is for "background" nodes and one is for "foreground" stuff. This is because I want to draw nodes in specific places, but let the routing algorithm do it's thing without these extra nodes causing troubles. In other words, I have made an annotation nodes by using another GraphViewer underneath the first GraphViewer (by setting the background to transparent).

My question is: is there a way to "sync" these two layers? I mean, I need them to be the same size and exactly the same position all the time. Right now, if I put stuff to (0,0) coordinates in both GraphViewers, nodes seem to be slightly offset in the output.

Also, is there a way to "mirror" mouse movements to the other GraphViewer? So when I drag and zoom the first layer, the layer below acts accordingly?

levnach commented 2 years ago

Not sure how to achieve this. It seems to mirror both viewers need to subscribe to the same mouse event which happens when some of the viewers is not necessarily in focus.

NiklasVJM commented 2 years ago

Yes, it is a bit of a tricky situation. Other way to solve this problem, is that we could somehow make the routing algorithm to ignore some nodes. Is this possible? So for the routing algorithm and arrows from one node to another, some nodes and their visible boundaries would just not be there.