Commit 722db268 authored by Yan's avatar Yan

Speedup of the GUI

* fixed zooming sluggishness by proper implementation of the scroll_event
parent 3b215c7f
......@@ -45,9 +45,9 @@ class AugFigureCanvas(FigureCanvas):
self.setAutoFillBackground(False)
self.paramstable = dt.table(["", "name", "value"], 100)
pan_factory(self.chromplot)
zoom_factory(self.chromplot, 1.15)
zoom_factory(self.chromplot, 1e-3)
pan_factory(self.spectplot, self.ms)
zoom_factory(self.spectplot, 1.15, self.ms)
zoom_factory(self.spectplot, 1e-3, self.ms)
textedit_factory(self.spectplot, self.ms)
self.mass_selector = AugSpanSelector(self.spectplot, self.ms)
self.time_selector = SpanSelector(
......@@ -138,16 +138,7 @@ def zoom_factory(axis, base_scale, plot_data=None):
def zoom_fun(event, pd, ax, scale):
"""zoom when scrolling"""
if event.inaxes == axis:
if event.button == 'up':
# zoom in
scale_factor = 1/scale
elif event.button == 'down':
# zoom out
scale_factor = scale
else:
# should not happen
scale_factor = 1
print(event.button)
scale_factor = np.power(scale,-event.step)
if QtWidgets.QApplication.keyboardModifiers() !=\
QtCore.Qt.ShiftModifier:
data = event.ydata
......@@ -169,7 +160,7 @@ def zoom_factory(axis, base_scale, plot_data=None):
fig = axis.get_figure()
fig.canvas.mpl_connect('scroll_event', lambda event: zoom_fun(
event, plot_data, axis, base_scale))
event, plot_data, axis, 1+base_scale))
def pan_factory(axis, plot=None):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment