Fixed ViewBox.updateViewRange so that transformation is updated for sigXRangeChanged and sigYRangeChanged in PySide2.

This commit is contained in:
Matt Liberty 2019-05-29 20:02:00 -04:00
parent 52fef555ee
commit b3c0bf635d

View File

@ -1496,14 +1496,13 @@ class ViewBox(GraphicsWidget):
changed = [(viewRange[i][0] != self.state['viewRange'][i][0]) or (viewRange[i][1] != self.state['viewRange'][i][1]) for i in (0,1)] changed = [(viewRange[i][0] != self.state['viewRange'][i][0]) or (viewRange[i][1] != self.state['viewRange'][i][1]) for i in (0,1)]
self.state['viewRange'] = viewRange self.state['viewRange'] = viewRange
# emit range change signals
if changed[0]:
self.sigXRangeChanged.emit(self, tuple(self.state['viewRange'][0]))
if changed[1]:
self.sigYRangeChanged.emit(self, tuple(self.state['viewRange'][1]))
if any(changed): if any(changed):
self._matrixNeedsUpdate = True self._matrixNeedsUpdate = True
# emit range change signals
if changed[0]:
self.sigXRangeChanged.emit(self, tuple(self.state['viewRange'][0]))
if changed[1]:
self.sigYRangeChanged.emit(self, tuple(self.state['viewRange'][1]))
self.sigRangeChanged.emit(self, self.state['viewRange']) self.sigRangeChanged.emit(self, self.state['viewRange'])
self.update() self.update()