1
0
Fork 0

Add gesture to resize UI.

This commit is contained in:
namedkitten 2020-04-23 16:25:40 +01:00
parent a2a70fc40c
commit bb31d80ba9
2 changed files with 35 additions and 2 deletions

View file

@ -14,7 +14,7 @@ Item {
anchors.right: parent.right anchors.right: parent.right
property var background: controlsBackground property var background: controlsBackground
property var progress: progressBar property var combinedHeight: progressBar.height + controlsBackground.height
property var controls: controlsBar property var controls: controlsBar
property var duration: progressBar.to property var duration: progressBar.to
property bool controlsShowing: true property bool controlsShowing: true

View file

@ -304,6 +304,39 @@ Window {
} }
} }
MouseArea {
anchors.fill: parent
width: parent.width
height: parent.height
property real velocity: 0.0
property int xStart: 0
property int xPrev: 0
property bool tracing: false
hoverEnabled: false
propagateComposedEvents: true
z: 1010
onPressed: {
xStart = mouse.x
xPrev = mouse.x
velocity = 0
}
onPositionChanged: {
var currVel = (mouse.x-xPrev)
velocity = (velocity + currVel)/2.0
xPrev = mouse.x
}
onReleased: {
if ( velocity > 2 && mouse.x > parent.width*0.2 ) {
appearance.scaleFactor += 0.2
} else if ( velocity < -2 && mouse.x > parent.width*0.2 ) {
appearance.scaleFactor -= 0.2
} else {
console.info(velocity, mouse.x)
}
}
}
Item { Item {
id: controlsOverlay id: controlsOverlay
anchors.centerIn: player anchors.centerIn: player
@ -326,7 +359,7 @@ Window {
MouseArea { MouseArea {
id: mouseAreaBar id: mouseAreaBar
width: parent.width width: parent.width
height: (controlsBar.controls.height * 2) + controlsBar.progress.height height: controlsBar.combinedHeight
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 0 anchors.bottomMargin: 0
hoverEnabled: true hoverEnabled: true