Skip to content

Commit

Permalink
Fix a DataInspector bug if inspector_label is used with RGB images (#…
Browse files Browse the repository at this point in the history
…3468)

If the creation of a custom tooltip was attempted with RGB type images
the inspector would error after attempting to convert the Colorant to a
Float32 using the Point3f constructor for the position parameter.

For cases in which RGB values are being plotted we now call the
inspector_label function using a Tuple for its third argument instead,
avoiding the error and allowing the RGB values to be used in the
construction of the custom string.
  • Loading branch information
Sagnac authored Jan 24, 2024
1 parent 2b97ce7 commit 67c32ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/interaction/inspector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,8 @@ function show_imagelike(inspector, plot, name, edge_based)
end

if haskey(plot, :inspector_label)
tt.text[] = plot[:inspector_label][](plot, (i, j), Point3f(pos[1], pos[2], z))
ins_p = z isa Colorant ? (pos[1], pos[2], z) : Point3f(pos[1], pos[2], z)
tt.text[] = plot[:inspector_label][](plot, (i, j), ins_p)
else
tt.text[] = color2text(name, x, y, z)
end
Expand Down

0 comments on commit 67c32ce

Please sign in to comment.