public GLink( GElement source, String sourceAnchorKey, GElement target, String targetAnchorKey, int shape, String pattern, double flateness) { this.source = source; this.target = target; this.sourceAnchorKey = sourceAnchorKey; this.targetAnchorKey = targetAnchorKey; this.shape = shape; this.pattern = pattern; initializeLink(flateness); if (source == target) link.setDirection(new Vector2D(0, 1)); else link.setDirection(source.getPosition().sub(target.getPosition())); setSourceTangentOffset(source.getDefaultAnchorOffset(sourceAnchorKey)); setTargetTangentOffset(target.getDefaultAnchorOffset(targetAnchorKey)); }
public void setMousePosition(Point mouse) { link.setDirection(Vector2D.vector(mouse).sub(target.getPosition())); link.setMousePosition(Vector2D.vector(mouse)); }