spring_layout

2 views
Skip to first unread message

nies.stephan

unread,
Sep 16, 2009, 9:31:25 PM9/16/09
to WireIt
Hello all,

I did take a look at the spring layout
and i like it. Since i am thinking
about using it for a callgraph browser
kind of gui i toyed a bit around.

One problem was, that after a switched
on the close button, the Layout would
crash if i would close a node.

I could fix that by placing

this.edges = [];

// Extract wires
for(var i = 0 ; i < this.layer.wires.length ; i++) {
var wire = this.layer.wires[i];
this.edges.push([this.layer.containers.indexOf
(wire.terminal1.container),
this.layer.containers.indexOf
(wire.terminal2.container) ]);
}

inside the run: function() in Layer.js
because otherwise the this.edges doesn't get updated when a Node and
it's edges get removed. Of course it would be even better if the
Container
would inform the layout, so that it doesn't have to check all the
time.

So this then made it possible to click away certain nodes, you are not
interested in. Now the second thing i would like to do is:

Introduce a second button, that if u click it reveals all the direct
neighbours
of a node and the respective edges. That way you could navigate a
huge flowchart (like a callgraph for example) and still have a good
overview.

But i didn't manage to get the second button (the neighbour button)
working
i tried to copy and paste every call to the closeButton and thereby
create
a second button but i failed.

Could someone please explain me how to do it?

Cheers,
Stephan



Eric Abouaf

unread,
Sep 18, 2009, 5:22:35 AM9/18/09
to wir...@googlegroups.com
Hi Stephan,

Indeed I kept the edges variable "static" for performance issues.
A better way to do it would be to subscribe to the layer events to recalculate this.edges only when needed...

Concerning the second button, I don't get what's not working. Did you add a new handler for this new button ?
--
Eric Abouaf
eric....@gmail.com
Tél: 06 29 86 37 89
Reply all
Reply to author
Forward
0 new messages