Skip to content

Commit

Permalink
Fix points selection (napari#902)
Browse files Browse the repository at this point in the history
* fix points selection 2D to 3D

* add 3d selection test
  • Loading branch information
kevinyamauchi authored Jan 24, 2020
1 parent a10a88b commit 47af135
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions napari/layers/points/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,10 @@ def _set_view_slice(self):
ind = list(self._indices_view).index(c)
selected.append(ind)
self._selected_view = selected
if len(selected) == 0:
self.selected_data
self._selected_box = self.interaction_box(self._selected_view)
if self.dims.ndisplay == 2:
self._selected_box = self.interaction_box(self._selected_view)
else:
self._selected_box = None

def _set_highlight(self, force=False):
"""Render highlights of shapes including boundaries, vertices,
Expand Down
5 changes: 5 additions & 0 deletions napari/layers/points/tests/test_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,14 @@ def test_selecting_points():
np.random.seed(0)
data = 20 * np.random.random(shape)
layer = Points(data)
layer.mode = 'select'
layer.selected_data = [0, 1]
assert layer.selected_data == [0, 1]

# test switching to 3D
layer.dims.ndisplay = 3
assert layer.selected_data == []


def test_adding_points():
"""Test adding Points data."""
Expand Down

0 comments on commit 47af135

Please sign in to comment.