From 5bb5c7487cb536c616cddc60cf5849308e0b4bac Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Sat, 30 Mar 2013 22:25:46 -0400 Subject: [PATCH] Prevent updating ViewBox matrix in setRange when no changes have been made to range --- pyqtgraph/graphicsItems/ViewBox/ViewBox.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py index 338cdde4..0a625d48 100644 --- a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py +++ b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py @@ -87,6 +87,7 @@ class ViewBox(GraphicsWidget): self.addedItems = [] #self.gView = view #self.showGrid = showGrid + self.matrixNeedsUpdate = True ## indicates that range has changed, but matrix update was deferred self.state = { @@ -406,8 +407,11 @@ class ViewBox(GraphicsWidget): self.sigStateChanged.emit(self) - if update: + if update and (any(changed) or self.matrixNeedsUpdate): self.updateMatrix(changed) + + if not update and any(changed): + self.matrixNeedsUpdate = True for ax, range in changes.items(): link = self.linkedView(ax) @@ -1246,6 +1250,7 @@ class ViewBox(GraphicsWidget): self.sigRangeChanged.emit(self, self.state['viewRange']) self.sigTransformChanged.emit(self) ## segfaults here: 1 + self.matrixNeedsUpdate = False def paint(self, p, opt, widget): if self.border is not None: