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()