thanks
For anyone interested, mycode for centering the graph by the root node
is:
var nodeCenter = vgraph.graph.nodeByStringId
("my_root_node_id").vnode.viewCenter.x * vgraph.scale;
vgraph.scroll(0, -1 * vgraph.origin.y); // I overrid scale() to
scroll only the X, hence the 0
var gCenter:Number = vgraph.center.x;
vgraph.scroll((gCenter - nodeCenter) / vgraph.scale, 0);
if I wanted to center according to the (whole) graph i'd go:
var bb:Rectangle = vgraph.calcNodesBoundingBox();
var bCenter:Number = (bb.x - (15 * vgraph.scale) + (bb.width / 2)) *
vgraph.scale; // the center of bounds
vgraph.scroll((gCenter - bCenter) / vgraph.scale, 0);
(not sure what will happen in case the graph exceeds the canvas,
though it should work)