Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LMS
FishUI
Commits
18bb26a9
Commit
18bb26a9
authored
Oct 29, 2020
by
Andy Regensky
Browse files
Add mouse wheel zoom interaction in perspective widget
parent
50a4afcc
Changes
2
Hide whitespace changes
Inline
Side-by-side
fishui/MainViewModel.py
View file @
18bb26a9
...
...
@@ -172,7 +172,7 @@ class MainViewModel(QObject):
self
.
updateBlockProjection
()
def
setPerspectiveScale
(
self
,
scale
):
self
.
perspective_scale
=
scale
self
.
perspective_scale
=
max
(
min
(
10
,
scale
),
1
)
self
.
propertiesDidChange
.
emit
()
self
.
updateBlockProjection
()
...
...
fishui/widgets/PerspectiveBlockWidget.py
View file @
18bb26a9
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
)
self
.
viewModel
.
setPerspectiveScale
(
new_scale
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment