Skip to content

Commit

Permalink
Merge pull request #1470 from kecnry/blink-click-update
Browse files Browse the repository at this point in the history
Fix updating coordinate displaying when blinking via click
  • Loading branch information
pllim authored Jul 11, 2022
2 parents aec90f1 + f9783c5 commit ebf8cc3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Specviz
Bug Fixes
---------

- Fix updating coordinate display when blinking via click. [#1470]

Cubeviz
^^^^^^^

Expand Down
6 changes: 5 additions & 1 deletion jdaviz/configs/imviz/plugins/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,13 @@ def activate(self):
def deactivate(self):
self.viewer.remove_event_callback(self.on_click)

def on_click(self, *args):
def on_click(self, data):
self.viewer.blink_once()

# Also update the coordinates display.
data['event'] = 'mousemove'
self.viewer.on_mouse_or_key_event(data)


@viewer_tool
class MatchBoxZoom(_MatchedZoomMixin, BoxZoom):
Expand Down
6 changes: 4 additions & 2 deletions jdaviz/configs/imviz/tests/test_linking.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def test_wcslink_fallback_pixels(self):
assert self.viewer.label_mouseover.world_ra_deg == ''
assert self.viewer.label_mouseover.world_dec_deg == ''

# blink image through keypress
self.viewer.on_mouse_or_key_event({'event': 'keydown', 'key': 'b',
'domain': {'x': 0, 'y': 0}})
assert self.viewer.label_mouseover.pixel == 'x=00.0 y=00.0'
Expand Down Expand Up @@ -119,8 +120,9 @@ def test_wcslink_affine_with_extras(self):
assert self.viewer.label_mouseover.world_ra_deg == '337.5202808000'
assert self.viewer.label_mouseover.world_dec_deg == '-20.8333330600'

self.viewer.on_mouse_or_key_event({'event': 'keydown', 'key': 'b',
'domain': {'x': 0, 'y': 0}})
# blink image through clicking with blink tool
self.viewer.toolbar_nested.active_tool_id = 'jdaviz:blinkonce'
self.viewer.toolbar_nested.active_tool.on_click({'domain': {'x': 0, 'y': 0}})
assert self.viewer.label_mouseover.pixel == 'x=00.0 y=00.0'
assert self.viewer.label_mouseover.value == '+1.00000e+00 '
assert self.viewer.label_mouseover.world_ra_deg == '337.5202808000'
Expand Down

0 comments on commit ebf8cc3

Please sign in to comment.