Fix a DataInspector bug if inspector_label
is used with RGB images
#3468
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
If the creation of a custom tooltip was attempted with
RGB
type images the inspector would error after attempting to convert theColorant
to aFloat32
using thePoint3f
constructor for the position parameter.For cases in which RGB values are being plotted we now call the
inspector_label
function using aTuple
for its third argument instead, avoiding the error and allowing the RGB values to be used in the construction of the custom string.Reproduction of the bug:
which would produce
As for the solution, we could skip the
Colorant
check and just return aTuple
instead, but if for whatever reason someone's script or package is currently expecting aPoint3f
type as before this would change that behaviour, so we call using aTuple
only whenz
is aColorant
; although using aTuple
universally here is much simpler of course.Type of change