Skip to content

Commit

Permalink
Merge pull request #103 from Carifio24/selection-layer-top
Browse files Browse the repository at this point in the history
Move selection layer to top when active
  • Loading branch information
Carifio24 authored Nov 18, 2024
2 parents 764bf51 + db3e0c7 commit 7efeb32
Showing 1 changed file with 8 additions and 3 deletions.
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

0 comments on commit 7efeb32

Please sign in to comment.