@@ -22,48 +22,99 @@ Rectangle {
22 id: overlay
22 id: overlay
23 objectName: "overlay"
23 objectName: "overlay"
25− readonly property real scaleProgress: (scale - initialScale) / (1.0 - initialScale)
25+ readonly property real aspectRatio: width / height
26+ readonly property real initialAspectRatio: initialWidth / initialHeight
27+ readonly property real initialXScale: initialWidth / width
28+ readonly property real initialYScale: initialHeight / height
27 property alias delegate: loader.sourceComponent
30 property alias delegate: loader.sourceComponent
28 property alias delegateItem: loader.item
31 property alias delegateItem: loader.item
29 property alias headerShown: overlayHeader.shown
32 property alias headerShown: overlayHeader.shown
30− property bool shown: false
31− property bool opening: false
32 property real initialX: 0
33 property real initialX: 0
33 property real initialY: 0
34 property real initialY: 0
34− property real initialScale: 0
35+ property real initialWidth: 1
35−
36+ property real initialHeight: 1
36− visible: scale > initialScale
37+
37− clip: visible && scale < 1.0
38+ property real xScale: initialXScale
38− scale: shown ? 1.0 : initialScale
39+ property real yScale: initialYScale
40+ property real progress: 0
44+ visible: progress > 0
45+ clip: progress > 0 && progress < 1
46+ color: Qt.rgba(0, 0, 0, progress)
39 transformOrigin: Item.TopLeft
47 transformOrigin: Item.TopLeft
40− transform: Translate {
48+ transform: [
52+ xScale: overlay.xScale
53+ yScale: overlay.yScale
41− x: overlay.initialX - overlay.initialX * overlay.scaleProgress
56+ x: overlay.initialX - overlay.initialX * overlay.progress
42− y: overlay.initialY - overlay.initialY * overlay.scaleProgress
57+ y: overlay.initialY - overlay.initialY * overlay.progress
44− color: Qt.rgba(0, 0, 0, scaleProgress)
59+ ]
45− radius: units.gu(1) - units.gu(1) * scaleProgress
60+ state: "hidden"
64+ PropertyChanges { target: overlay; progress: 1; xScale: 1; yScale: 1 }
68+ PropertyChanges { target: overlay; progress: 0; xScale: initialXScale; yScale: initialYScale }
75+ UbuntuNumberAnimation {
77+ properties: "progress,xScale,yScale"
78+ duration: UbuntuAnimation.FastDuration
84+ UbuntuNumberAnimation {
86+ properties: "progress,xScale,yScale"
87+ duration: UbuntuAnimation.FastDuration / 2
47 function show() {
92 function show() {
49− shown = true;
93+ state = "shown"
52 function hide() {
96 function hide() {
53− opening = false;
97+ state = "hidden"
58− UbuntuNumberAnimation {
59− duration: overlay.opening ? UbuntuAnimation.FastDuration :
60− UbuntuAnimation.FastDuration / 2
65 id: loader
101 id: loader
66 anchors.fill: parent
102 anchors.fill: parent
104+ readonly property bool verticalScaling: initialAspectRatio / aspectRatio >= 1
105+ readonly property real initialXScale: verticalScaling ? 1 : aspectRatio / initialAspectRatio
106+ readonly property real initialYScale: verticalScaling ? initialAspectRatio / aspectRatio : 1
107+ readonly property real xScale: verticalScaling ? loader.initialXScale - loader.initialXScale * overlay.progress + overlay.progress :
108+ loader.yScale * overlay.yScale / overlay.xScale
109+ readonly property real yScale: verticalScaling ? loader.xScale * overlay.xScale / overlay.yScale :
110+ loader.initialYScale - loader.initialYScale * overlay.progress + overlay.progress
113+ origin.x: parent.width / 2
114+ origin.y: parent.height / 2
115+ xScale: loader.xScale
116+ yScale: loader.yScale
69 Rectangle {
120 Rectangle {
@@ -77,7 +128,7 @@ Rectangle {
78 height: units.gu(7)
129 height: units.gu(7)
79 visible: opacity > 0
130 visible: opacity > 0
80− opacity: overlay.scaleProgress > 0.6 && shown ? 0.8 : 0
131+ opacity: overlay.state == "shown" && overlay.progress > 0.8 && shown ? 0.8 : 0
81 color: "black"
132 color: "black"
83 Behavior on opacity {
134 Behavior on opacity {