Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix nested toolbar losing suboptions #2605

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Bug Fixes
- Fix image layer visibility toggle in plot options. [#2595]


- Fixes viewer toolbar items losing ability to bring up right-click menu. [#2605]

Cubeviz
^^^^^^^

Expand Down
12 changes: 7 additions & 5 deletions jdaviz/components/toolbar_nested.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def _update_tool_visibilities(self):
for menu_ind in range(self._max_menu_ind):
has_primary = False
n_visible = 0
primary_id = None
if self.active_tool_id:
current_primary_active = self.tools_data[self.active_tool_id]['menu_ind'] == menu_ind # noqa
else:
Expand Down Expand Up @@ -116,15 +115,18 @@ def _update_tool_visibilities(self):
primary = visible and not has_primary

if primary:
primary_id = tool_id
has_primary = True

self.tools_data[tool_id] = {**info,
'primary': primary,
'visible': visible}
if primary_id:
self.tools_data[primary_id] = {**self.tools_data[primary_id],
'has_suboptions': n_visible > 1}

# update has_suboptions for all entries in this menu
for tool_id, info in self.tools_data.items():
if info['menu_ind'] != menu_ind:
continue
self.tools_data[tool_id] = {**self.tools_data[tool_id],
'has_suboptions': n_visible > 1}

# mutation to dictionary needs to be manually sent to update the UI
self.send_state("tools_data")
Expand Down
Loading