2 * Copyright (C) 2014 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 import Ubuntu.Components 1.1
19 import "../../Components"
25 readonly property real scaleProgress: (scale - initialScale) / (1.0 - initialScale)
27 property alias delegate: loader.sourceComponent
28 property alias delegateItem: loader.item
29 property alias headerShown: overlayHeader.shown
30 property bool shown: false
31 property bool opening: false
32 property real initialX: 0
33 property real initialY: 0
34 property real initialScale: 0
36 visible: scale > initialScale
37 clip: visible && scale < 1.0
38 scale: shown ? 1.0 : initialScale
39 transformOrigin: Item.TopLeft
40 transform: Translate {
41 x: overlay.initialX - overlay.initialX * overlay.scaleProgress
42 y: overlay.initialY - overlay.initialY * overlay.scaleProgress
44 color: Qt.rgba(0, 0, 0, scaleProgress)
45 radius: units.gu(1) - units.gu(1) * scaleProgress
58 UbuntuNumberAnimation {
59 duration: overlay.opening ? UbuntuAnimation.FastDuration :
60 UbuntuAnimation.FastDuration / 2
72 property bool shown: true
80 opacity: overlay.scaleProgress > 0.6 && shown ? 0.8 : 0
84 UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration }
88 id: overlayCloseButton
89 objectName: "overlayCloseButton"
97 onClicked: overlay.hide()
101 color: Qt.rgba(1.0, 1.0, 1.0, 0.3)
102 visible: overlayCloseButton.pressed
107 anchors.centerIn: parent
110 color: Theme.palette.normal.foregroundText