Skip to content
Closed
21 changes: 20 additions & 1 deletion glue_jupyter/ipyvolume/common/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from glue.core.roi import PolygonalROI, CircularROI, RectangularROI, Projected3dROI

from glue.config import viewer_tool
from glue.viewers.common.tool import CheckableTool
from glue.viewers.common.tool import Tool, CheckableTool
from glue.viewers.matplotlib

__all__ = []

Expand Down Expand Up @@ -64,6 +65,24 @@ class IpyvolumeLassoMode(IpyvolumePolygonMode):

selector = 'lasso'

@viewer_tool
class IpyvolumePointMode(IPyVolumeCheckableTool):
icon = 'glue_point'
tool_id = 'select:point'
action_text = 'Select Point'
tool_tip = 'Select a single pixel for e.g. spectral slicing'

# pretty sure this is wrong
selector = 'point'

def on_selection(self, data, other=None):
if data['type'] != self.selector:
return

if data['device']:
with self.viewer._output_widget or nullcontext():
x1, y1 = data['device']


@viewer_tool
class IpyvolumeCircleMode(IPyVolumeCheckableTool):
Expand Down
2 changes: 1 addition & 1 deletion glue_jupyter/ipyvolume/common/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IpyvolumeBaseView(IPyWidgetView):

_options_cls = Viewer3DStateWidget

tools = ['ipyvolume:lasso', 'ipyvolume:circle', 'ipyvolume:rectangle']
tools = ['ipyvolume:lasso', 'ipyvolume:circle', 'ipyvolume:rectangle', 'ipyvolume:point']

def __init__(self, *args, **kwargs):

Expand Down
Loading