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

slide zoom too

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