private int getDistance(@NotNull BalloonImpl balloon, @NotNull Dimension size) {
      if (balloon.myCornerToPointerDistance < 0) return -1;

      int indent = balloon.getArc() + balloon.getPointerWidth(this) / 2;
      if (balloon.myCornerToPointerDistance < indent) return indent;

      int limit = this == ABOVE || this == BELOW ? size.width - indent : size.height - indent;
      return Math.min(balloon.myCornerToPointerDistance, limit);
    }
private int getDistance(@NotNull BalloonImpl balloon, @NotNull Dimension size)