Skip to content

Commit 788cc5e

Browse files
committed
fix bug when edge iterator passed to graphline
1 parent 0f9ca82 commit 788cc5e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lines.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ function graphline(edge_list, locs_x, locs_y, nodesize::Vector{T}, arrowlength,
2323
endy = locs_y[j] + nodesize[j]*sin+π)
2424
arr1, arr2 = arrowcoords(θ, endx, endy, arrowlength, angleoffset)
2525
endx0, endy0 = midpoint(arr1, arr2)
26-
if Edge(j,i) in edge_list[1:e_idx-1] #check if a reverse arc exists
27-
e_idx2 = findfirst(==(Edge(j,i)), edge_list) #get index of reverse arc
26+
e_idx2 = findfirst(==(Edge(j,i)), collect(edge_list)) #get index of reverse arc
27+
if !isnothing(e_idx2) && e_idx2 < e_idx #only make changes if lines/arrows have already been defined for that arc
2828
startx, starty = midpoint(arrows[e_idx2][[1,3]]...) #get midopint of reverse arc and use as new start point
2929
lines[e_idx2][1] = (endx0, endy0) #update endpoint of reverse arc
3030
end
@@ -50,8 +50,8 @@ function graphline(edge_list, locs_x, locs_y, nodesize::Real, arrowlength, angle
5050
endy = locs_y[j] + nodesize*sin+π)
5151
arr1, arr2 = arrowcoords(θ, endx, endy, arrowlength, angleoffset)
5252
endx0, endy0 = midpoint(arr1, arr2)
53-
if Edge(j,i) in edge_list[1:e_idx-1] #check if a reverse arc exists
54-
e_idx2 = findfirst(==(Edge(j,i)), edge_list) #get index of reverse arc
53+
e_idx2 = findfirst(==(Edge(j,i)), collect(edge_list)) #get index of reverse arc
54+
if !isnothing(e_idx2) && e_idx2 < e_idx #only make changes if lines/arrows have already been defined for that arc
5555
startx, starty = midpoint(arrows[e_idx2][[1,3]]...) #get midopint of reverse arc and use as new start point
5656
lines[e_idx2][1] = (endx0, endy0) #update endpoint of reverse arc
5757
end

0 commit comments

Comments
 (0)