18 import
"../Components"
19 import Ubuntu.Components 0.1
20 import Ubuntu.Gestures 0.1
21 import Unity.Launcher 0.1
26 property bool available:
true
28 property int panelWidth: units.gu(8)
29 property int dragAreaWidth: units.gu(1)
30 property int minimizeDistance: units.gu(26)
31 property real progress: dragArea.dragging && dragArea.touchX > panelWidth ?
32 (width * (dragArea.touchX-panelWidth) / (width - panelWidth)) :
33 (dragArea.dragging ? 0.001 : 0)
35 readonly property
bool shown: panel.x > -panel.width
38 signal launcherApplicationSelected(
string appId)
50 dismissTimer.restart()
59 fadeOutAnimation.start();
62 function switchToNextState(state) {
63 animateTimer.nextState = state
82 if (!panel.preventHiding) {
85 dismissTimer.restart()
97 property string nextState:
""
102 root.state = nextState
106 SequentialAnimation {
110 panel.layer.enabled =
true
113 UbuntuNumberAnimation {
116 easing.type: Easing.InQuad
121 panel.layer.enabled =
false
122 panel.animate =
false;
124 panel.x = -panel.width
126 panel.animate =
true;
133 enabled: root.state ==
"visible"
135 anchors.rightMargin: -units.gu(2)
143 if (panel.x < -panel.width/3) {
144 root.switchToNextState(
"")
146 root.switchToNextState(
"visible")
154 left: launcherDragArea.right
157 bottom: parent.bottom
159 enabled: root.state ==
"visible"
169 opacity: root.state ==
"visible" ? 0.6 : 0
171 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.BriskDuration } }
176 objectName:
"launcherPanel"
177 enabled: root.available
178 width: root.panelWidth
181 bottom: parent.bottom
184 opacity: (x == -width && dragArea.status === DirectionalDragArea.WaitingForTouch) ? 0 : 1
187 property
bool animate:
true
189 onApplicationSelected: {
191 launcherApplicationSelected(appId)
198 onPreventHidingChanged: {
199 if (dismissTimer.running) {
200 dismissTimer.restart();
205 enabled: !dragArea.dragging && !launcherDragArea.drag.active && panel.animate;
208 easing.type: Easing.OutCubic
212 Behavior on opacity {
214 duration: UbuntuAnimation.FastDuration; easing.type: Easing.OutCubic
222 direction: Direction.Rightwards
224 enabled: root.available
225 width: root.dragAreaWidth
229 if (status !== DirectionalDragArea.Recognized || launcher.state ==
"visible")
238 var targetPanelX = Math.min(0, touchX - panel.width)
239 var delta = targetPanelX - panel.x
241 panel.x += 0.4 * delta
246 if (distance > panel.width / 2) {
247 if (distance > minimizeDistance) {
250 root.switchToNextState(
"visible")
253 root.switchToNextState(
"")
276 when: teaseTimer.running
279 x: -root.panelWidth + units.gu(2)