Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
more rectangle region stuff
  • Loading branch information
kushalkolar committed May 22, 2023
commit fb27dc1f99d2411daf4f396550533fd3fa0d03b9
53 changes: 29 additions & 24 deletions fastplotlib/graphics/selectors/_rectangle_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def _set(self, value: Tuple[float, float, float, float]):

# change the edge lines

# each edge line is defined by two end points which are stored in the
# geometry.positions
# [x0, y0, z0]
# [x1, y1, z0]

Expand Down Expand Up @@ -118,31 +120,34 @@ def _set(self, value: Tuple[float, float, float, float]):
# calls any events
self._feature_changed(key=None, new_data=value)

# TODO: feature_changed
def _feature_changed(self, key: Union[int, slice, Tuple[slice]], new_data: Any):
return

if len(self._event_handlers) < 1:
return

if self._parent.parent is not None:
selected_ixs = self._parent.get_selected_indices()
selected_data = self._parent.get_selected_data()
else:
selected_ixs = None
selected_data = None

pick_info = {
"index": None,
"collection-index": self._collection_index,
"world_object": self._parent.world_object,
"new_data": new_data,
"selected_indices": selected_ixs,
"selected_data": selected_data
}

event_data = FeatureEvent(type="bounds", pick_info=pick_info)

self._call_event_handlers(event_data)
# if len(self._event_handlers) < 1:
# return
#
# if self._parent.parent is not None:
# selected_ixs = self._parent.get_selected_indices()
# selected_data = self._parent.get_selected_data()
# else:
# selected_ixs = None
# selected_data = None
#
# pick_info = {
# "index": None,
# "collection-index": self._collection_index,
# "world_object": self._parent.world_object,
# "new_data": new_data,
# "selected_indices": selected_ixs,
# "selected_data": selected_data
# "graphic",
# "delta",
# "pygfx_event"
# }
#
# event_data = FeatureEvent(type="bounds", pick_info=pick_info)
#
# self._call_event_handlers(event_data)


class RectangleRegionSelector(Graphic, BaseSelector):
Expand Down Expand Up @@ -280,7 +285,7 @@ def __init__(

# add the edge lines
for edge in self.edges:
edge.position.set_z(-1)
edge.position.set(*origin, -1)
self.world_object.add(edge)

self._resizable = resizable
Expand Down