Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions fastplotlib/graphics/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,14 @@ def __init__(
selection
selection_indices: Union[list, range]
"""
self._parent = parent
self._selection = selection
self._selection_indices = selection_indices

for attr_name in self._selection[0].__dict__.keys():
attr = getattr(self._selection[0], attr_name)
# we use parent.graphics[0] instead of selection[0]
# because the selection can be empty
for attr_name in self._parent.graphics[0].__dict__.keys():
attr = getattr(self._parent.graphics[0], attr_name)
if isinstance(attr, GraphicFeature):
collection_feature = CollectionFeature(
parent,
Expand Down Expand Up @@ -368,13 +371,16 @@ def __init__(

self._feature_instances: List[GraphicFeature] = list()

for graphic in self._selection:
fi = getattr(graphic, self._feature)
self._feature_instances.append(fi)
if len(self._selection) > 0:
for graphic in self._selection:
fi = getattr(graphic, self._feature)
self._feature_instances.append(fi)

if isinstance(fi, GraphicFeatureIndexable):
self._indexable = True
else:
if isinstance(fi, GraphicFeatureIndexable):
self._indexable = True
else:
self._indexable = False
else: # it's an empty selection so it doesn't really matter
self._indexable = False

def _set(self, value):
Expand Down