glue-viz / glue-vispy-viewers

3-d data viewers for glue based on VisPy
http://glueviz.org/en/stable/whatsnew/experimental_3d.html#experimental-3d
BSD 2-Clause "Simplified" License
25 stars 21 forks source link

selection_tools VispyMouseMode incompatible with custom BaseCartesianData classes #364

Open mmorys opened 3 years ago

mmorys commented 3 years ago

Describe the bug The currently documented means for creating a custom Glue data class involves inheriting from BaseCartesianData. A custom data class inheriting from BaseCartesianData will not be of type Data.

In order to utilize selection tools with a 3D scatter plot, the data must pass two type-checks to verify it is of type Data, making selection incompatible with custom data types. https://github.com/glue-viz/glue-vispy-viewers/blob/53ff17976be156a9b25285cf21c2c89acb94da03/glue_vispy_viewers/common/selection_tools.py#L40 https://github.com/glue-viz/glue-vispy-viewers/blob/53ff17976be156a9b25285cf21c2c89acb94da03/glue_vispy_viewers/common/selection_tools.py#L47

Expected behavior I would expect full compatibility of 3D Scatter plots with custom data classes.

Simple Fix I am able to make the selection tool work properly in my local installation of glue-vispy-viewers with a simple change of these lines (and of course importing BaseCartesianData from glue.core) to:

if isinstance(layer_artist.layer, BaseCartesianData): 

I don't know what side effects this may have, but I could submit a pull request with this fix.

Details: