Skip to content

Commit

Permalink
fix #243
Browse files Browse the repository at this point in the history
  • Loading branch information
slowkow committed Jan 5, 2024
1 parent fc0733b commit ee13920
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/geom-label-repel.R
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ makeLabelRepelGrobs <- function(
!point_inside_text &&
d > 0 &&
# Distance from label to point edge is greater than minimum.
euclid(int, point_int) > min.segment.length &&
(!is.na(min.segment.length) && euclid(int, point_int) > min.segment.length) &&
# Distance from label to point edge is less than from label to point center.
euclid(int, point_int) < euclid(int, point_pos) &&
# Distance from label to point center is greater than point size.
Expand Down
2 changes: 1 addition & 1 deletion R/geom-text-repel.R
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ makeTextRepelGrobs <- function(
!point_inside_text &&
d > 0 &&
# Distance from label to point edge is greater than minimum.
euclid(int, point_int) > min.segment.length &&
(!is.na(min.segment.length) && euclid(int, point_int) > min.segment.length) &&
# Distance from label to point edge is less than from label to point center.
euclid(int, point_int) < euclid(int, point_pos) &&
# Distance from label to point center is greater than point size.
Expand Down
4 changes: 4 additions & 0 deletions src/repel_boxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,10 @@ DataFrame repel_boxes2(
force_pull = 1e-6;
}

if (force_push == 0) {
max_iter = 0;
}

// Try to catch errors.
if (n_texts > n_points) {
Rcerr << "n_texts is " << n_texts << std::endl;
Expand Down

0 comments on commit ee13920

Please sign in to comment.