0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 11:41:49 +02:00

fix(plot_base): update mouse mode state on mode change

This commit is contained in:
2025-03-03 21:51:53 +01:00
parent 6c286b02e8
commit 1f548bbf9b

View File

@ -86,6 +86,7 @@ class MouseInteractionToolbarBundle(ToolbarBundle):
self.actions["switch_mouse"].actions["drag_mode"].action.setChecked(not checked) self.actions["switch_mouse"].actions["drag_mode"].action.setChecked(not checked)
if self.target_widget and checked: if self.target_widget and checked:
self.target_widget.plot_item.getViewBox().setMouseMode(pg.ViewBox.RectMode) self.target_widget.plot_item.getViewBox().setMouseMode(pg.ViewBox.RectMode)
self.mouse_mode = "RectMode"
@SafeSlot(bool) @SafeSlot(bool)
def enable_mouse_pan_mode(self, checked: bool): def enable_mouse_pan_mode(self, checked: bool):
@ -98,6 +99,7 @@ class MouseInteractionToolbarBundle(ToolbarBundle):
self.actions["switch_mouse"].actions["rectangle_mode"].action.setChecked(not checked) self.actions["switch_mouse"].actions["rectangle_mode"].action.setChecked(not checked)
if self.target_widget and checked: if self.target_widget and checked:
self.target_widget.plot_item.getViewBox().setMouseMode(pg.ViewBox.PanMode) self.target_widget.plot_item.getViewBox().setMouseMode(pg.ViewBox.PanMode)
self.mouse_mode = "PanMode"
@SafeSlot() @SafeSlot()
def autorange_plot(self): def autorange_plot(self):