~aacid/unity8/drag_with_quicklist

« back to all changes in this revision

Viewing changes to qml/Launcher/Launcher.qml

  • Committer: CI Train Bot
  • Author(s): Daniel d'Andrada
  • Date: 2015-11-26 13:50:39 UTC
  • mfrom: (2056.1.4 mouseEdgePush)
  • Revision ID: ci-train-bot@canonical.com-20151126135039-y1bj8jp4mycez05f
Mouse has to push against edges to show launcher or apps spread

edge-barrier-sensitivity is the property that should show up in the System Settings GUI.

edge-barrier-min-push and edge-barrier-max-push are exposed in GSettings merely as a convenience so you can tweak those values without having to restart unity8. But they should NOT show up in system settings. Fixes: #1510969
Approved by: Michael Zanetti

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2013-2014 Canonical, Ltd.
 
2
 * Copyright (C) 2013-2015 Canonical, Ltd.
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
5
5
 * it under the terms of the GNU General Public License as published by
84
84
        }
85
85
    }
86
86
 
 
87
    function pushEdge(amount) {
 
88
        if (root.state === "") {
 
89
            edgeBarrier.push(amount);
 
90
        }
 
91
    }
 
92
 
87
93
    Timer {
88
94
        id: teaseTimer
89
95
        interval: mode == "teasing" ? 200 : 300
96
102
        interval: 500
97
103
        onTriggered: {
98
104
            if (root.autohideEnabled) {
99
 
                if (!panel.preventHiding && !hoverArea.containsMouse) {
 
105
                if (!panel.preventHiding) {
100
106
                    root.state = ""
101
107
                } else {
102
108
                    dismissTimer.restart()
176
182
                root.switchToNextState("visible")
177
183
            }
178
184
        }
179
 
 
180
185
    }
181
186
 
182
187
    MultiPointTouchArea {
203
208
        Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.BriskDuration } }
204
209
    }
205
210
 
 
211
    EdgeBarrier {
 
212
        id: edgeBarrier
 
213
        edge: Qt.LeftEdge
 
214
        target: parent
 
215
        enabled: root.available
 
216
        onPassed: { root.switchToNextState("visibleTemporary"); }
 
217
        material: Component {
 
218
            Item {
 
219
                Rectangle {
 
220
                    width: parent.height
 
221
                    height: parent.width
 
222
                    rotation: -90
 
223
                    anchors.centerIn: parent
 
224
                    gradient: Gradient {
 
225
                        GradientStop { position: 0.0; color: panel.color}
 
226
                        GradientStop { position: 1.0; color: Qt.rgba(panel.r,panel.g,panel.b,0)}
 
227
                    }
 
228
                }
 
229
            }
 
230
        }
 
231
    }
 
232
 
206
233
    LauncherPanel {
207
234
        id: panel
208
235
        objectName: "launcherPanel"
248
275
        }
249
276
    }
250
277
 
251
 
    // TODO: This should be replaced by some mechanism that reveals the launcher
252
 
    // after a certain resistance has been overcome, like unity7 does. However,
253
 
    // as we don't get relative mouse coordinates yet, this will do for now.
254
 
    MouseArea {
255
 
        id: hoverArea
256
 
        anchors { fill: panel; rightMargin: -1 }
257
 
        hoverEnabled: true
258
 
        propagateComposedEvents: true
259
 
        onContainsMouseChanged: {
260
 
            if (containsMouse) {
261
 
                root.switchToNextState("visibleTemporary");
262
 
            } else {
263
 
                dismissTimer.restart();
264
 
            }
265
 
        }
266
 
        onPressed: mouse.accepted = false;
267
 
 
268
 
        // We need to eat touch events here in order to make sure that
269
 
        // we don't trigger both, the dragArea and the hoverArea
270
 
        MultiPointTouchArea {
271
 
            anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
272
 
            width: units.dp(1)
273
 
            mouseEnabled: false
274
 
            enabled: parent.enabled
275
 
        }
276
 
    }
277
 
 
278
278
    DirectionalDragArea {
279
279
        id: dragArea
280
280
        objectName: "launcherDragArea"
322
322
                target: panel
323
323
                x: -root.x // so we never go past panelWidth, even when teased by tutorial
324
324
            }
325
 
            PropertyChanges { target: hoverArea; enabled: false }
326
325
        },
327
326
        State {
328
327
            name: "visibleTemporary"
331
330
                target: root
332
331
                autohideEnabled: true
333
332
            }
334
 
            PropertyChanges { target: hoverArea; enabled: true }
335
333
        },
336
334
        State {
337
335
            name: "teasing"