// Works which line segment the point of the label is closest to
mxPoint p0 = edgeState.getAbsolutePoint(0);
mxPoint pe = edgeState.getAbsolutePoint(1);
Line2D line = new Line2D.Double(p0.getPoint(), pe.getPoint());
double minDist = line.ptSegDistSq(x, y);
int index = 0;
double tmp = 0;
double length = 0;