Skip to content

Commit

Permalink
fix h/vlines
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer committed Jan 14, 2024
1 parent 3917891 commit 9761c6f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/interaction/inspector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1042,3 +1042,35 @@ function show_data(inspector::DataInspector, plot::Band, idx::Integer, mesh::Mes

return true
end



function show_data(inspector::DataInspector, plot::Union{HLines, VLines}, idx)
a = inspector.attributes
tt = inspector.plot
scene = parent_scene(plot)

lineplot = plot.plots[1]

# cast ray from cursor into screen, find closest point to line
pos = position_on_plot(lineplot, idx, apply_transform = true)
proj_pos = shift_project(scene, pos)
update_tooltip_alignment!(inspector, proj_pos)

tt.offset[] = ifelse(
a.apply_tooltip_offset[],
sv_getindex(lineplot.linewidth[], idx) + 2,
a.offset[]
)

pos = apply_transform(inverse_transform(transform_func(lineplot)), pos)
if haskey(plot, :inspector_label)
tt.text[] = plot[:inspector_label][](plot, idx, eltype(plot[1][])(pos))
else
tt.text[] = position2string(eltype(plot[1][])(pos))
end
tt.visible[] = true
a.indicator_visible[] && (a.indicator_visible[] = false)

return true
end

0 comments on commit 9761c6f

Please sign in to comment.