if (curSketch instanceof SketchPath
|| curSketch instanceof SketchSpline) {
Vec2D pointOnPath = curSketch.getClosestPointAlongPath(x, y);
if ((pointOnPath != null && closestPoint == null)
|| (pointOnPath != null && pointOnPath
.distanceTo(new Vec2D(x, y)) < closestPoint
.distanceTo(new Vec2D(x, y)))) {
closestPoint = new SketchPoint(pointOnPath.copy());
closestShape = curSketch;