Skip to content

Commit

Permalink
fix updating default viewer menu on change in link type
Browse files Browse the repository at this point in the history
generalization still needs to be made for the multi-viewer case
  • Loading branch information
kecnry committed Nov 3, 2023
1 parent a387275 commit 47d3fc1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jdaviz/components/viewer_data_select_item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</v-btn>
</j-tooltip>
</div>
<div v-else-if="item.has_wcs">
<div v-else-if="!linkedByWcs() || item.has_wcs">
<j-tooltip tipid="viewer-data-enable">
<v-btn
icon
Expand Down
6 changes: 6 additions & 0 deletions jdaviz/configs/imviz/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,9 @@ def link_image_data(app, link_type='pixels', wcs_fallback_scheme=None, wcs_use_a
Invalid inputs or reference data.
"""
# to avoid any confusion with the capitalized-versions in the links control plugin, let's
# just always compare against lowercase here.
link_type = link_type.lower()
if len(app.data_collection) <= 1 and link_type != 'wcs': # No need to link, we are done.
return

Expand Down Expand Up @@ -653,10 +656,13 @@ def link_image_data(app, link_type='pixels', wcs_fallback_scheme=None, wcs_use_a

app._link_type = link_type
app._wcs_use_affine = wcs_use_affine
# TODO: this all needs to be generalized to work on multiple viewers
# (including determining refdata)
viewer_ref = app._jdaviz_helper.default_viewer.reference
viewer_item = app._get_viewer_item(viewer_ref)

viewer_item['reference_data_label'] = refdata.label
viewer_item['linked_by_wcs'] = link_type == 'wcs'

if link_plugin is not None:
# Only broadcast after success.
Expand Down

0 comments on commit 47d3fc1

Please sign in to comment.