summaryrefslogtreecommitdiff
path: root/src/main/python/utils/graphics.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/python/utils/graphics.py')
-rw-r--r--src/main/python/utils/graphics.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py
index aed7eed..8c87b96 100644
--- a/src/main/python/utils/graphics.py
+++ b/src/main/python/utils/graphics.py
@@ -8,19 +8,27 @@ class customView(QGraphicsView):
super(customView, self).__init__(scene, parent)
else:
super(customView, self).__init__(parent)
- self.zoom = 1
+ self._zoom = 1
self.setDragMode(True)
def wheelEvent(self, QWheelEvent):
if Qt.ControlModifier:
- temp = self.zoom
if QWheelEvent.source() == Qt.MouseEventNotSynthesized:
if self.zoom + QWheelEvent.angleDelta().y()/2880 > 0.1:
self.zoom += QWheelEvent.angleDelta().y()/2880
else:
if self.zoom + QWheelEvent.pixelDelta().y() > 0.1:
self.zoom += QWheelEvent.angleDelta().y()
- self.scale(self.zoom / temp, self.zoom / temp)
QWheelEvent.accept()
else:
- return super().wheelEvent(self, QWheelEvent) \ No newline at end of file
+ return super().wheelEvent(self, QWheelEvent)
+
+ @property
+ def zoom(self):
+ return self._zoom
+
+ @zoom.setter
+ def zoom(self, value):
+ temp = self.zoom
+ self._zoom = value
+ self.scale(self.zoom / temp, self.zoom / temp) \ No newline at end of file