forked from M-Labs/artiq
scanwidget: fix div by zero rubberband width (closes #335) (4b8fe1e)
This commit is contained in:
parent
223657fa63
commit
d60eaa7b44
|
@ -159,10 +159,13 @@ class ScanWidget(QtWidgets.QWidget):
|
|||
if self._drag == "zoom":
|
||||
self._rubber.hide()
|
||||
left, scale = self._axisView
|
||||
scale *= self.width()/self._rubber.geometry().width()
|
||||
center = self._pixelToAxis(self._rubber.geometry().center().x())
|
||||
if center:
|
||||
scale = min(scale, self.dynamicRange/abs(center))
|
||||
if self._rubber.geometry().width():
|
||||
scale *= self.width()/self._rubber.geometry().width()
|
||||
if center:
|
||||
scale = min(scale, self.dynamicRange/abs(center))
|
||||
elif center:
|
||||
scale = self.dynamicRange/abs(center)
|
||||
left = self.width()/2 - center*scale
|
||||
self._setView(left, scale)
|
||||
self._drag = None
|
||||
|
|
Loading…
Reference in New Issue