Skip to content

Commit

Permalink
SelectionGizmo: deal with lines
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Feb 16, 2025
1 parent 2a811ad commit 61e4afb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions octarine/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def find_selected_objects(self):
objects = self.gizmo._viewer.objects[name]
for ob in objects:
# Extract the data depending on the type of object
if not isinstance(ob, (gfx.Mesh, gfx.Points)):
if not isinstance(ob, (gfx.Mesh, gfx.Points, gfx.Line)):
# Note to self: we could use object boundaries where no data is available
if self.gizmo._debug:
print(f"Object {ob} not supported")
Expand All @@ -545,7 +545,15 @@ def find_selected_objects(self):

# Store the results
is_clipped = bool(np.any(mask)) # avoid getting np.True_/np.False_
is_contained = bool(np.all(mask))

if isinstance(ob, gfx.Line):
# Lines can have breaks where the data will be `nan` - these will
# always count as not inside the selection box. We need to ignore
# these when checking for full containment.
data_not_nan = np.all(~np.isnan(data), axis=1)
is_contained = bool(np.all(mask[data_not_nan]))
else:
is_contained = bool(np.all(mask))

# If the object is either fully contained or fully outside, we don't
# really need to pass the mask
Expand Down

0 comments on commit 61e4afb

Please sign in to comment.