@@ -22,48 +22,94 @@ 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
36+ property real initialHeight: 1
36− visible: scale > initialScale
38+ property real xScale: 0
37− clip: visible && scale < 1.0
39+ property real yScale: 0
38− scale: shown ? 1.0 : initialScale
40+ property real progress: 0
42+ visible: progress > 0
43+ clip: progress > 0 && progress < 1
44+ color: Qt.rgba(0, 0, 0, progress)
39 transformOrigin: Item.TopLeft
45 transformOrigin: Item.TopLeft
40− transform: Translate {
46+ transform: [
50+ xScale: overlay.xScale
51+ yScale: overlay.yScale
41− x: overlay.initialX - overlay.initialX * overlay.scaleProgress
54+ x: overlay.initialX - overlay.initialX * overlay.progress
42− y: overlay.initialY - overlay.initialY * overlay.scaleProgress
55+ y: overlay.initialY - overlay.initialY * overlay.progress
44− color: Qt.rgba(0, 0, 0, scaleProgress)
57+ ]
45− radius: units.gu(1) - units.gu(1) * scaleProgress
58+ state: "hidden"
62+ PropertyChanges { target: overlay; progress: 1; xScale: 1; yScale: 1 }
66+ PropertyChanges { target: overlay; progress: 0; xScale: initialXScale; yScale: initialYScale }
73+ UbuntuNumberAnimation {
75+ properties: "progress,xScale,yScale"
76+ duration: UbuntuAnimation.FastDuration
82+ UbuntuNumberAnimation {
84+ properties: "progress,xScale,yScale"
85+ duration: UbuntuAnimation.FastDuration / 2
47 function show() {
90 function show() {
49− shown = true;
91+ state = "shown"
52 function hide() {
94 function hide() {
53− opening = false;
95+ state = "hidden"
58− UbuntuNumberAnimation {
59− duration: overlay.opening ? UbuntuAnimation.FastDuration :
60− UbuntuAnimation.FastDuration / 2
65 id: loader
99 id: loader
66 anchors.fill: parent
100 anchors.fill: parent
102+ readonly property real initialXScale: initialAspectRatio >= 1 ? 1 : aspectRatio / initialAspectRatio
103+ readonly property real initialYScale: initialAspectRatio >= 1 ? initialAspectRatio / aspectRatio : 1
104+ readonly property real xScale: loader.initialXScale - loader.initialXScale * overlay.progress + overlay.progress
105+ readonly property real yScale: loader.initialYScale - loader.initialYScale * overlay.progress + overlay.progress
108+ origin.x: parent.width / 2
109+ origin.y: parent.height / 2
110+ xScale: loader.xScale
111+ yScale: loader.yScale
69 Rectangle {
115 Rectangle {
@@ -77,7 +123,7 @@ Rectangle {
78 height: units.gu(7)
124 height: units.gu(7)
79 visible: opacity > 0
125 visible: opacity > 0
80− opacity: overlay.scaleProgress > 0.6 && shown ? 0.8 : 0
126+ opacity: overlay.state == "shown" && overlay.progress > 0.8 && shown ? 0.8 : 0
81 color: "black"
127 color: "black"
83 Behavior on opacity {
129 Behavior on opacity {