Commit a2f32b92 authored by Alberto Mardegan's avatar Alberto Mardegan
Browse files

QML, ViewerPage: primitive pinch and panning

parent e372927b
......@@ -10,8 +10,29 @@ Page {
title: qsTr("VNC Client - Viewer")
VncOutput {
id: viewer
PinchArea {
property real initialScale: 1.0
property point initialCenter
anchors.fill: parent
onPinchStarted: {
initialScale = viewer.scale
initialCenter = viewer.center
}
onPinchUpdated: {
var requestedScale = initialScale * pinch.scale
var diffX = (pinch.center.x - pinch.startCenter.x) /
requestedScale
var diffY = (pinch.center.y - pinch.startCenter.y) /
requestedScale
viewer.scale = requestedScale
viewer.center = Qt.point(initialCenter.x - diffX, initialCenter.y - diffY)
}
VncOutput {
id: viewer
anchors.fill: parent
enabled: !parent.pinch.active
}
}
}
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