Commit 18bb26a9 authored by Andy Regensky's avatar Andy Regensky
Browse files

Add mouse wheel zoom interaction in perspective widget

parent 50a4afcc
......@@ -172,7 +172,7 @@ class MainViewModel(QObject):
def setPerspectiveScale(self, scale):
self.perspective_scale = scale
self.perspective_scale = max(min(10, scale), 1)
import sys
from PySide2.QtGui import QPainter, QColor, QPen, QPalette, QPolygonF
from PySide2.QtWidgets import QWidget
from PySide2.QtWidgets import QWidget, QApplication
from PySide2.QtCore import QSize, Qt, QPointF, QRect, Slot
from fishui.MainViewModel import MainViewModel
......@@ -127,3 +127,8 @@ class PerspectiveBlockWidget(QWidget):
self.initialMV0 = None
self.initialMV1 = None
self.initialMouse = None
def wheelEvent(self, event):
if QApplication.keyboardModifiers() == Qt.ControlModifier:
new_scale = self.viewModel.perspective_scale + (1 if event.angleDelta().y() < 0 else -1)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment