Hello,
when scrolling, the flowchart always zooms into the direction of the
current mouse position. I want to change it in such a way that it zooms
always into the center of the viewBox. Objects which are not located in the
center of the screen would therefore drift out of the viewable area. The
following codesnippet in the viewBox class manages the zooming behaviour.
Best Regards
Patrick S.
# Scrolling/Zooming via mouse wheel
def wheelEvent(self, ev, axis=None):
print(ev.pos(), ev.scenePos(), ev.screenPos())
mask = np.array(self.state['mouseEnabled'], dtype=np.float)
if axis is not None and axis >= 0 and axis < len(mask):
mv = mask[axis]
mask[:] = 0
mask[axis] = mv
s = ((mask * 0.02) + 1) ** (ev.delta() * self.state['wheelScaleFactor']) #
actual scaling factor
center =
Point(fn.invertQTransform(self.childGroup.transform()).map(ev.pos()))
self._resetTarget()
self.scaleBy(s, center)
self.sigRangeChangedManually.emit(self.state['mouseEnabled'])
ev.accept()
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/f64b78c9-6a1c-41b1-b13a-165d4b97417d%40googlegroups.com.