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()
58 function switchToNextState(state) {
59 animateTimer.nextState = state
78 if (!panel.preventHiding) {
81 dismissTimer.restart()
93 property string nextState:
""
98 root.state = nextState
104 enabled: root.state ==
"visible"
106 anchors.rightMargin: -units.gu(2)
114 if (panel.x < -panel.width/3) {
115 root.switchToNextState(
"")
117 root.switchToNextState(
"visible")
125 left: launcherDragArea.right
128 bottom: parent.bottom
130 enabled: root.state ==
"visible"
140 opacity: root.state ==
"visible" ? 0.6 : 0
142 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.BriskDuration } }
147 objectName:
"launcherPanel"
148 enabled: root.available
149 width: root.panelWidth
152 bottom: parent.bottom
155 opacity: (x == -width && dragArea.status === DirectionalDragArea.WaitingForTouch) ? 0 : 1
158 property
bool animate:
true
160 onApplicationSelected: {
162 launcherApplicationSelected(appId)
169 onPreventHidingChanged: {
170 if (dismissTimer.running) {
171 dismissTimer.restart();
178 duration: dragArea.dragging || launcherDragArea.drag.active ? 0 : 300;
179 easing.type: Easing.OutCubic
183 Behavior on opacity {
185 duration: UbuntuAnimation.FastDuration; easing.type: Easing.OutCubic
193 direction: Direction.Rightwards
195 enabled: root.available
196 width: root.dragAreaWidth
200 if (status !== DirectionalDragArea.Recognized || launcher.state ==
"visible")
209 var targetPanelX = Math.min(0, touchX - panel.width)
210 var delta = targetPanelX - panel.x
212 panel.x += 0.4 * delta
217 if (distance > panel.width / 2) {
218 root.switchToNextState(
"visible")
219 if (distance > minimizeDistance) {
223 root.switchToNextState(
"")
246 when: teaseTimer.running
249 x: -root.panelWidth + units.gu(2)