Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: P. L. Lim <[email protected]>
  • Loading branch information
kecnry and pllim authored Feb 7, 2023
1 parent d9e0a92 commit 158d3b9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions jdaviz/configs/cubeviz/plugins/tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def test_fits_image_hdu_with_microns(image_cube_hdu_obj_microns, cubeviz_helper)
label_mouseover._viewer_mouse_event(unc_viewer,
{'event': 'mousemove', 'domain': {'x': -1, 'y': 0}})
assert label_mouseover.as_text()[0] == 'Pixel x=-1.0 y=00.0' # Out of bounds
# remaining lines are unvalidated,
# see https://github.com/spacetelescope/jdaviz/pull/1976#discussion_r1093199919
# FIXME: remaining lines are unvalidated,
# see https://github.com/spacetelescope/jdaviz/issues/1991
# 'World 13h41m45.5759s +27d00m12.3044s (ICRS)',
# '205.4398995981 27.0034178810 (deg)') # noqa

Expand Down
1 change: 1 addition & 0 deletions jdaviz/configs/cubeviz/plugins/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __init__(self, *args, **kwargs):

@property
def active_image_layer(self):
"""Active image layer in the viewer, if available."""
# Find visible layers
visible_layers = [layer for layer in self.state.layers
if (layer.visible and layer_is_cube_image_data(layer.layer))]
Expand Down
1 change: 1 addition & 0 deletions jdaviz/configs/default/plugins/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def _on_subset_create(self, msg):

@property
def active_image_layer(self):
"""Active image layer in the viewer, if available."""
# Find visible layers
visible_layers = [layer for layer in self.state.layers
if (layer.visible and layer_is_image_data(layer.layer))]
Expand Down
9 changes: 6 additions & 3 deletions jdaviz/configs/imviz/plugins/coords_info/coords_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,12 @@ def _viewer_mouse_clear_event(self, viewer, data=None):

def _viewer_mouse_event(self, viewer, data):
if data['event'] in ('mouseleave', 'mouseenter'):
return self._viewer_mouse_clear_event(viewer, data)
self._viewer_mouse_clear_event(viewer, data)
return

if len(self.app.data_collection) < 1:
return self._viewer_mouse_clear_event(viewer)
self._viewer_mouse_clear_event(viewer)
return

# otherwise a mousemove event, we need to get cursor coordinates and update the display

Expand All @@ -127,7 +129,8 @@ def _viewer_mouse_event(self, viewer, data):
y = data['domain']['y']

if x is None or y is None: # Out of bounds
return self._viewer_mouse_clear_event(viewer)
self._viewer_mouse_clear_event(viewer)
return

# update last known cursor position (so another event like a change in layers can update
# the coordinates with the last known position)
Expand Down

0 comments on commit 158d3b9

Please sign in to comment.