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

Move selection layer to top when active #103

Merged
merged 1 commit into from
Nov 18, 2024
Merged
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
11 changes: 8 additions & 3 deletions glue_plotly/viewers/common/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,15 @@ def _update_selection_layer_bounds(self):
dy = self.state.y_max - self.state.y_min
self.selection_layer.update(x0=x0, dx=dx, y0=y0, dy=dy)

def set_selection_active(self, visible):
if visible:
def _bring_selection_layer_to_top(self):
selection_layer = self.selection_layer
self.figure.data = [trace for trace in self.figure.data if trace is not selection_layer] + [selection_layer]

def set_selection_active(self, active):
if active:
self._update_selection_layer_bounds()
# self.selection_layer.update(visible=visible)
self._bring_selection_layer_to_top()
# self.selection_layer.update(visible=active)

def set_selection_callback(self, on_selection):
self.selection_layer.on_selection(on_selection)
Expand Down
Loading