Skip to content

Commit

Permalink
enable mouseover display for cube viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Jan 23, 2024
1 parent 5391845 commit 761961f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions lcviz/plugins/coords_info/coords_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
from jdaviz.core.events import ViewerRenamedMessage
from jdaviz.core.registries import tool_registry

from lcviz.viewers import TimeScatterView, PhaseScatterView
from lcviz.viewers import TimeScatterView, PhaseScatterView, CubeView

__all__ = ['CoordsInfo']


@tool_registry('lcviz-coords-info')
class CoordsInfo(CoordsInfo):
_supported_viewer_classes = (TimeScatterView, PhaseScatterView)
_supported_viewer_classes = (TimeScatterView, PhaseScatterView, CubeView)
_viewer_classes_with_marker = (TimeScatterView, PhaseScatterView)

def __init__(self, *args, **kwargs):
Expand All @@ -25,12 +25,7 @@ def __init__(self, *args, **kwargs):
def _viewer_renamed(self, msg):
self._marks[msg.new_viewer_ref] = self._marks.pop(msg.old_viewer_ref)

def update_display(self, viewer, x, y):
self._dict = {}

if not len(viewer.state.layers):
return

def _lc_viewer_update(self, viewer, x, y):
is_phase = isinstance(viewer, PhaseScatterView)
# TODO: update with display_unit when supported in lcviz
x_unit = '' if is_phase else str(viewer.time_unit)
Expand Down Expand Up @@ -138,3 +133,14 @@ def _cursor_fallback():

self.marks[viewer._reference_id].update_xy([closest_x], [closest_y]) # noqa
self.marks[viewer._reference_id].visible = True

def update_display(self, viewer, x, y):
self._dict = {}

if not len(viewer.state.layers):
return

if isinstance(viewer, (TimeScatterView, PhaseScatterView)):
self._lc_viewer_update(viewer, x, y)
elif isinstance(viewer, CubeView):
self._image_viewer_update(viewer, x, y)

0 comments on commit 761961f

Please sign in to comment.