Skip to content

Commit 8a54595

Browse files
committed
Fix layer selection
1 parent b01809f commit 8a54595

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/napari_matplotlib/histogram.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ def on_update_layers(self) -> None:
5555
Called when the selected layers are updated.
5656
"""
5757
super().on_update_layers()
58-
for layer in self.viewer.layers:
59-
layer.events.contrast_limits.connect(self._update_contrast_lims)
58+
if self._valid_layer_selection:
59+
self.layers[0].events.contrast_limits.connect(
60+
self._update_contrast_lims
61+
)
6062

6163
def _update_contrast_lims(self) -> None:
6264
for lim, line in zip(

0 commit comments

Comments
 (0)