Fixed ViewBox error when accessing zoom history before having zoomed.

This commit is contained in:
Luke Campagnola 2014-05-18 19:14:57 -04:00
parent ab411012f8
commit 279ad1bee0

View File

@ -1312,6 +1312,8 @@ class ViewBox(GraphicsWidget):
ev.ignore() ev.ignore()
def scaleHistory(self, d): def scaleHistory(self, d):
if len(self.axHistory) == 0:
return
ptr = max(0, min(len(self.axHistory)-1, self.axHistoryPointer+d)) ptr = max(0, min(len(self.axHistory)-1, self.axHistoryPointer+d))
if ptr != self.axHistoryPointer: if ptr != self.axHistoryPointer:
self.axHistoryPointer = ptr self.axHistoryPointer = ptr