Commit 9acba267 authored by Marco Martin's avatar Marco Martin

slide zoom too

parent 59b57b5e
...@@ -43,7 +43,7 @@ Rectangle { ...@@ -43,7 +43,7 @@ Rectangle {
Item { Item {
id: mainContent id: mainContent
width: parent.width width: parent.width
height: flow.y + flow.height height: flow.y + flow.height + root.height
Flow { Flow {
id: flow id: flow
anchors { anchors {
...@@ -87,31 +87,41 @@ Rectangle { ...@@ -87,31 +87,41 @@ Rectangle {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
property int oldY property int oldY
property real startY
onClicked: { onClicked: {
root.state = "switcher" root.state = "switcher"
} }
onPressed: { onPressed: {
if (root.state == "app") { if (root.state == "app") {
return; root.state = "zooming";
} } else {
root.state = "dragging"; root.state = "dragging";
}
oldY = mouse.y; oldY = mouse.y;
startY = mouse.y;
} }
onPositionChanged: { onPositionChanged: {
if (root.state == "app") { if (root.state == "app" || root.state == "zooming") {
return; mainFlickable.scale = (1 - (startY - mouse.y) / root.height);
// mainFlickable.contentY -= oldY - mouse.y;
} else {
mainFlickable.contentY += oldY - mouse.y;
} }
mainFlickable.contentY += oldY - mouse.y;
oldY = mouse.y; oldY = mouse.y;
} }
onReleased: { onReleased: {
if (root.state == "app") { if (root.state == "app" || root.state == "zooming") {
return; if (mainFlickable.scale < 0.7) {
} root.state = "switcher"
if (mainFlickable.contentY < root.height) { } else {
root.state = "homescreen" root.state = "app"
}
} else { } else {
root.state = "switcher" if (mainFlickable.contentY < root.height) {
root.state = "homescreen"
} else {
root.state = "switcher"
}
} }
} }
} }
...@@ -125,7 +135,7 @@ Rectangle { ...@@ -125,7 +135,7 @@ Rectangle {
x: -root.width / 2 x: -root.width / 2
y: -root.height / 2 y: -root.height / 2
interactive: true interactive: true
contentY: root.height*2 contentY: root.height*2 + (root.currentApp ? root.currentApp.y : 0)
visible: true visible: true
} }
}, },
...@@ -141,6 +151,18 @@ Rectangle { ...@@ -141,6 +151,18 @@ Rectangle {
visible: true visible: true
} }
}, },
State {
name: "zooming"
PropertyChanges {
target: mainFlickable
scale: scale
x: (-root.currentApp.x * (mainFlickable.scale/0.5 - 1) ) + (2 - mainFlickable.scale/0.5) * (-root.width / 2)
y: (-root.height / 2) * (2 - mainFlickable.scale/0.5)
interactive: true
contentY: (root.height*2 + (root.currentApp ? root.currentApp.y : 0)) * (2 - mainFlickable.scale/0.5) + (root.height*2 + root.currentApp.y) * (mainFlickable.scale/0.5 - 1)
visible: true
}
},
State { State {
name: "app" name: "app"
PropertyChanges { PropertyChanges {
...@@ -170,6 +192,9 @@ Rectangle { ...@@ -170,6 +192,9 @@ Rectangle {
Transition { Transition {
to: "dragging" to: "dragging"
}, },
Transition {
to: "zooming"
},
Transition { Transition {
SequentialAnimation { SequentialAnimation {
ScriptAction { ScriptAction {
...@@ -189,6 +214,7 @@ Rectangle { ...@@ -189,6 +214,7 @@ Rectangle {
script: { script: {
if (root.state == "homescreen") { if (root.state == "homescreen") {
mainFlickable.visible = false; mainFlickable.visible = false;
root.currentApp = null;
} }
} }
} }
......
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