This file is indexed.

/usr/share/unity8/Components/EdgeDragEvaluator.qml is in unity8-common 8.12+16.04.20160401-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * Copyright (C) 2013 Canonical, Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Gestures 0.1

/*
   Evaluates end velocity (velocity at the moment the gesture ends) and travelled
   distance (delta between finger down and finger up positions) to determine
   whether the drag should continue by itself towards completion (auto-complete)
   after the finger has left the touchscreen.
 */
AxisVelocityCalculator {

    // How far the drag can go, or should go to achieve completion.
    property real maxDragDistance

    // Ending a drag at any point before this threshold will need some positive velocity
    // (i.e., towards the set direction) to get auto-completion (e.g. to get show()
    // called for a hidden Showable) and ending a drag at any point after this
    // threshold will need some negative velocity to avoid auto-completion.
    property real dragThreshold: maxDragDistance / 2

    property real minDragDistance: maxDragDistance * 0.1

    // Speed needed to get auto-completion for an hypothetical flick of length zero.
    //
    // This requirement is gradually reduced as flicks gets longer until it reaches
    // a value of zero for flicks of dragThreshold lenght.
    //
    // in pixels per second
    property real speedThreshold: units.gu(70)

    property int direction

    property real velocity
    property real minVelocity

    // Returns whether the drag should continue by itself until completed.
    function shouldAutoComplete() {
        var deltaPos = trackedPosition - __startPosition;

        if (Math.abs(deltaPos) < minDragDistance) {
            velocity = 0;
            minVelocity = 0;
            return false;
        }

        velocity = calculate();
        minVelocity = __calculateMinimumVelocityForAutoCompletion();

        if (_dragDirectionIsPositive()) {
            return velocity >= minVelocity;
        } else {
            return velocity <= minVelocity;
        }
    }

    property real __startPosition

    // speedThreshold in pixels per millisecond
    property real __speedThresholdMs: speedThreshold / 1000.0

    function _dragDirectionIsPositive() {
        if (direction === Direction.Horizontal) {
            return (trackedPosition - __startPosition) > 0;
        } else {
            return Direction.isPositive(direction);
        }
    }

    function __calculateMinimumVelocityForAutoCompletion() {
        // Minimum velocity when a drag total distance is zero
        var v0 = _dragDirectionIsPositive() ? __speedThresholdMs : - __speedThresholdMs;
        var deltaPos = trackedPosition - __startPosition;

        return v0 - ((__speedThresholdMs / dragThreshold) * deltaPos);
    }

    function reset() {
        __startPosition = trackedPosition;
    }
}