forward port the scrolling fixes of plasma1 vers

This commit is contained in:
Marco Martin 2013-06-21 23:40:41 +02:00
parent 95870ffae2
commit c0f3730686
2 changed files with 18 additions and 6 deletions

View File

@ -151,7 +151,7 @@ function initPage(page, properties) {
} }
container.page = page; container.page = page;
if (page.parent == null) { if (page.parent == null || page.parent == container.pageParent) {
container.owner = container; container.owner = container;
} else { } else {
container.owner = page.parent; container.owner = page.parent;

View File

@ -125,7 +125,7 @@ Item {
return return
} }
scrollAnimation.to = Math.max(0, Math.min(Math.max(0, columnWidth * level - columnWidth), columnWidth*depth- mainFlickable.width)) scrollAnimation.to = Math.max(0, Math.min(Math.max(0, columnWidth * level - columnWidth), mainFlickable.contentWidth - mainFlickable.width))
scrollAnimation.running = true scrollAnimation.running = true
} }
@ -209,7 +209,8 @@ Item {
Row { Row {
id: root id: root
spacing: -100 spacing: -100
width: childrenRect.width - 100 width: Math.max((depth-1+children[children.length-1].takenColumns) * columnWidth, childrenRect.width - 100)
height: parent.height height: parent.height
Behavior on width { Behavior on width {
NumberAnimation { NumberAnimation {
@ -291,6 +292,9 @@ Item {
// State to be set after previous state change animation has finished // State to be set after previous state change animation has finished
property string pendingState: "none" property string pendingState: "none"
//how many columns take the page?
property alias takenColumns: actualContainer.takenColumns
// Ensures that transition finish actions are executed // Ensures that transition finish actions are executed
// in case the object is destroyed before reaching the // in case the object is destroyed before reaching the
// end state of an ongoing transition // end state of an ongoing transition
@ -308,7 +312,10 @@ Item {
right: parent.right right: parent.right
rightMargin: 100 rightMargin: 100
} }
width: (container.pageDepth >= actualRoot.depth ? Math.min(actualRoot.width, Math.max(1, Math.round(page.implicitWidth/columnWidth))*columnWidth) : columnWidth)
property int takenColumns: Math.max(1, Math.round(container.page ? container.page.implicitWidth/columnWidth : 1));
width: (container.pageDepth >= actualRoot.depth ? Math.min(actualRoot.width, takenColumns*columnWidth) : columnWidth)
} }
Image { Image {
@ -368,6 +375,10 @@ Item {
// Performs a push exit transition. // Performs a push exit transition.
function pushExit(replace, immediate, orientationChanges) function pushExit(replace, immediate, orientationChanges)
{ {
if (replace) {
setState(immediate ? "Hidden" : "Left");
}
if (actualRoot.visible && immediate) if (actualRoot.visible && immediate)
internal.setPageStatus(page, PageStatus.Inactive); internal.setPageStatus(page, PageStatus.Inactive);
if (replace) { if (replace) {
@ -523,8 +534,9 @@ Item {
page.parent = owner; page.parent = owner;
} }
} }
container.parent = null;
container.destroy(); container.visible = false;
destroy();
} }
} }
} }