Skip to content

Commit

Permalink
Merge pull request #355 from jfoster17/fix-subset-display-on-unlinked…
Browse files Browse the repository at this point in the history
…-scatters

Make sure invalid subsets don't display
  • Loading branch information
astrofrog authored May 12, 2023
2 parents d3aa76f + 06748aa commit 8ec97fb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions glue_jupyter/bqplot/scatter/layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,27 @@ def update(self):
try:
mask = self.layer.to_mask()
except IncompatibleAttribute:
self.scatter.selected = []
self.quiver.selected = []
self._set_subset_styles()
self.disable("Could not compute subset")
self._clear_selection()
return

selected_indices = np.nonzero(mask)[0].tolist()

self.scatter.selected = selected_indices
self.scatter.selected_style = {}
self.scatter.unselected_style = {'fill': 'none', 'stroke': 'none'}
self.quiver.selected = selected_indices
self.quiver.selected_style = {}
self.quiver.unselected_style = {'fill': 'none', 'stroke': 'none'}
self._set_subset_styles()

else:
self._clear_selection()

def _set_subset_styles(self):
self.scatter.selected_style = {}
self.scatter.unselected_style = {'fill': 'none', 'stroke': 'none'}
self.quiver.selected_style = {}
self.quiver.unselected_style = {'fill': 'none', 'stroke': 'none'}

def _clear_selection(self):
self.scatter.selected = None
self.scatter.selected_style = {}
Expand Down

0 comments on commit 8ec97fb

Please sign in to comment.