Skip to content

Commit

Permalink
fix new viewer after image rotation (#2677)
Browse files Browse the repository at this point in the history
* generalize app _on_new_viewer for non-imviz case
* limit logic block to only run for imviz
  • Loading branch information
kecnry authored Jan 26, 2024
1 parent 9414cd8 commit e6885df
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2317,11 +2317,15 @@ def _on_new_viewer(self, msg, vid=None, name=None, add_layers_to_viewer=False):
viewer=viewer, vid=vid, name=name, reference=name
)

ref_data = self._jdaviz_helper.default_viewer._obj.state.reference_data
new_viewer_item['reference_data_label'] = getattr(ref_data, 'label', None)

if hasattr(viewer, 'reference'):
viewer.state.reference_data = ref_data
if self.config == 'imviz':
# NOTE: if ever extending image rotation beyond imviz or adding non-image viewers
# to imviz: this currently assumes that the helper has a default_viewer and that is an
# image viewer
ref_data = self._jdaviz_helper.default_viewer._obj.state.reference_data
new_viewer_item['reference_data_label'] = getattr(ref_data, 'label', None)

if hasattr(viewer, 'reference'):
viewer.state.reference_data = ref_data

new_stack_item = self._create_stack_item(
container='gl-stack',
Expand Down

0 comments on commit e6885df

Please sign in to comment.