Hi again,
Thanks for your previous help.
I am noticing a problem (it seems to be with all JGo objects but its very obvious with subgraphs). My link under certain link setup conditions and postions, jumps to the centre of my subgraph, when it really shouldn’t.
I am expecting the link to try and draw the link from the from-port to the to-port and if it cannot as child of the object gets in the way, it point to that intersection point. If the from-port point is already “inside” the to-ports object then I guess pointing to the centre is ok (though I would like it to point at the port really).
To reproduce you need the “from end port” setFromSpot and the “to end port” setToSpot set to NoSpot, the toPort’s object as the subgraph, and the link setCubic(true).
I think its a problem somewhere in the depths of calculateStroke routine.
So in the BoxView.java I have the overridden method:
public void newLink(JGoPort from, JGoPort to) {
JGoDocument doc = getDocument();
if (doc == null) return;
JGoLabeledLink link = new JGoLabeledLink(from, to);
JGoLinkLabel label = new JGoLinkLabel("Hello");
label.setTransparent(false);
link.setMidLabel(label);
link.setCubic(true);
JGoSubGraphBase.reparentToCommonSubGraph(link, from, to, true, doc.getLinksLayer());
fireUpdate(JGoViewEvent.LINK_CREATED, 0, link);
doc.endTransaction(getEditPresentationName(4));
}
In TestSubGraph.java initPorts() method I have added:
myInput.setValidSource(false);
myInput.setPortObject(this);
myInput.setToSpot(NoSpot);
addObjectAtTail(myInput);
In BoxApp.java I had added in the init() method:
node2.setDragsNode(false);
node2.getPort().setFromSpot(JGoPort.NoSpot);
Now link the “second” node to the input port.
Try moving the “second” node around the canvas. You will see the link jump suddenly in to the centre of the subgraph when in certain positions.
Any ideas?
Thanks.
See attached image: