Skip to content
Snippets Groups Projects
Commit 7198f0e3 authored by SeeLook's avatar SeeLook :musical_note:
Browse files

Added pinch zoom to main score

parent ef362cab
No related branches found
No related tags found
No related merge requests found
...@@ -56,24 +56,37 @@ Score { ...@@ -56,24 +56,37 @@ Score {
} }
Timer { id: zoomTimer; interval: 500 } Timer { id: zoomTimer; interval: 500 }
MouseArea { PinchArea {
anchors.fill: parent anchors.fill: parent
z: -1 pinch.dragAxis: Pinch.XandYAxis
onWheel: { onPinchFinished: {
if (wheel.modifiers & Qt.ControlModifier) { if (pinch.scale > 1.2)
if (wheel.angleDelta.y > 0) { zoom(true)
if (!zoomTimer.running) { else if (pinch.scale < 0.8)
zoomInAct.trigger() zoom(false)
zoomTimer.running = true }
} // HACK: keeping MouseArea inside PinchArea makes it working
} else if (wheel.angleDelta.y < 0) { MouseArea {
if (!zoomTimer.running) { anchors.fill: parent
zoomOutAct.trigger() z: -1
zoomTimer.running = true onWheel: {
} if (wheel.modifiers & Qt.ControlModifier) {
} if (wheel.angleDelta.y > 0)
} else zoom(true)
wheel.accepted = false else if (wheel.angleDelta.y < 0)
zoom(false)
} else
wheel.accepted = false
}
}
}
function zoom(zoomIn) {
if (!zoomTimer.running) {
if (zoomIn)
zoomInAct.trigger()
else
zoomOutAct.trigger()
zoomTimer.running = true
} }
} }
......
...@@ -21,7 +21,6 @@ TlevelPreviewItem { ...@@ -21,7 +21,6 @@ TlevelPreviewItem {
text: instrumentGlyph text: instrumentGlyph
} }
PinchArea { PinchArea {
id: pinchArea
anchors.fill: parent anchors.fill: parent
pinch.target: levCol pinch.target: levCol
pinch.minimumScale: 0.5 pinch.minimumScale: 0.5
...@@ -34,10 +33,10 @@ TlevelPreviewItem { ...@@ -34,10 +33,10 @@ TlevelPreviewItem {
if (wheel.modifiers & Qt.ControlModifier) { if (wheel.modifiers & Qt.ControlModifier) {
if (wheel.angleDelta.y > 0) if (wheel.angleDelta.y > 0)
zoom(true) zoom(true)
else if (wheel.angleDelta.y < 0) else if (wheel.angleDelta.y < 0)
zoom(false) zoom(false)
} else } else
wheel.accepted = false wheel.accepted = false
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment