From 67c32ce0c99888bff4ae4a96e45afd78437c3208 Mon Sep 17 00:00:00 2001 From: Sagnac <83491030+Sagnac@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:49:42 +0000 Subject: [PATCH] Fix a DataInspector bug if `inspector_label` is used with RGB images (#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. --- src/interaction/inspector.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/interaction/inspector.jl b/src/interaction/inspector.jl index f2a25b52cc2..5a536e4c56e 100644 --- a/src/interaction/inspector.jl +++ b/src/interaction/inspector.jl @@ -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