int shift = actionIndex*(ACTION_SIZE+ACTION_DELIM) + addPixels;
if (((TransitionFigure) figure).hasSourceDecoration()) {
shift += 10;
}
PointList pointList = ((TransitionFigure) figure).getPoints();
Point point0 = pointList.getPoint(0);
Point point1 = pointList.getPoint(1);
Dimension diff = point1.getDifference(point0);
Point dist = new Point(diff.width, diff.height);
double distance = new Point(0, 0).getDistance(dist);
double scaleFactor = shift / distance;
Point translation = dist.getScaled(scaleFactor);
Point location = point0.getTranslated(translation);
location.x -= ACTION_SIZE/2;
location.y -= ACTION_SIZE/2;
return location;
} else {
NodeFigure nodeFigure = (NodeFigure) figure;
List<IFigure> children = nodeFigure.getActionsContainer().getChildren();
IFigure prevFigure;
if (children.size() > actionIndex) {
prevFigure = children.get(children.size() - 1 - actionIndex);
} else {
prevFigure = children.get(0);
}
Rectangle prevActionBounds = prevFigure.getBounds();
return new Point(prevActionBounds.x - 5, prevActionBounds.y);
/*
// invert visuals
actionIndex = size - actionIndex;
int xShift = actionIndex*(ACTION_SIZE+ACTION_DELIM) - addPixels;
int yShift = 3*ACTION_SIZE/2;