summaryrefslogtreecommitdiffstats
path: root/res/qml/Mixxx/Controls/WaveformOverviewMarker.qml
blob: 4f20bc4e555628dcbb7bbd81e012227fd81a3c06 (plain)
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
import Mixxx 0.1 as Mixxx
import QtQuick 2.12
import QtQuick.Shapes 1.12
import QtQuick.Window 2.12

Item {
    id: root

    property string group // required
    property string key // required
    property string color: "white"

    Shape {
        id: shape

        visible: control.value >= 0
        anchors.fill: parent
        antialiasing: true
        layer.smooth: true
        layer.samples: 2

        ShapePath {
            startX: marker.x
            startY: 0
            strokeColor: root.color
            strokeWidth: 1

            PathLine {
                id: marker

                property bool hovered: false

                x: 0
                y: root.height
            }

        }

    }

    Mixxx.ControlProxy {
        id: control

        group: root.group
        key: root.key
        onValueChanged: {
            // Math.round saves tons of CPU by avoiding redrawing for fractional pixel positions.
            marker.x = Math.round(parent.width * value * Screen.devicePixelRatio) / Screen.devicePixelRatio;
        }
    }

}