Reputation: 11
I'm getting the points of an edge like that: List<mxPoint> points = graph.getView().getState(edgeCell).getAbsolutePoints();
at the event: mxEvent.CHANGE
.
This is, as far as I know, the event that trigger after a change in the points of an edge. In the same event edgeCell.getGeometry().getPoints();
returns only one point, the center one, I believe.
When I try to apply this change programmatically (set the same points to a new edge), it doesn't work with graph.getView().getState(edgeCell).setAbsolutePoints(points);
. It seems that the points are passed to the state, but the change is not applied to the graph. Maybe I should trigger some event.
Then I tried setting these points to the geometry of the edge, these changes are applied to the graph, however it causes positioning problems. I believe that is because the absolute points (absolute positioning) are different from the geometry ones.
Any help on how should I proceed?
Upvotes: 0
Views: 142
Reputation: 11
I Found a solution here: http://forum.jgraph.com/questions/237/how-do-i-get-the-length-of-an-edge I was setting the absolute points inside the transaction (before endUpdate) but the state is created after it (what makes sense).
Besides setting the absolute points after the transaction I'm updating the edge like: graph.validateEdge(edgeCell.getSource(), edgeCell.getTarget(), edgeCell);
Not sure if is the best way to update this change, but seem to work for my case.
Upvotes: 1