diff --git a/org.eclipse.draw2d/src/org/eclipse/draw2d/MidpointLocator.java b/org.eclipse.draw2d/src/org/eclipse/draw2d/MidpointLocator.java index ffec794..58dc565 100644 --- a/org.eclipse.draw2d/src/org/eclipse/draw2d/MidpointLocator.java +++ b/org.eclipse.draw2d/src/org/eclipse/draw2d/MidpointLocator.java @@ -52,7 +52,8 @@ /** * Returns the point of reference associated with this locator. This point - * will be midway between points at 'index' and 'index' + 1. + * will be midway between the point at position 'index' and the point at the + * last position. * * @return the reference point * @since 2.0 @@ -61,7 +62,7 @@ Connection conn = getConnection(); Point p = Point.SINGLETON; Point p1 = conn.getPoints().getPoint(getIndex()); - Point p2 = conn.getPoints().getPoint(getIndex() + 1); + Point p2 = conn.getPoints().getPoint(conn.getPoints().size() - 1); conn.translateToAbsolute(p1); conn.translateToAbsolute(p2); p.x = (p2.x - p1.x) / 2 + p1.x;