summaryrefslogtreecommitdiff
path: root/modules/notifications/Background.qml
blob: e3289af348e7188be9a671054ca732037101c766 (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
53
54
55
56
57
58
59
60
61
import "root:/services"
import "root:/config"
import QtQuick
import QtQuick.Shapes

Shape {
    id: root

    required property real wrapperWidth
    required property real wrapperHeight
    readonly property real rounding: BorderConfig.rounding
    readonly property bool flatten: wrapperHeight < rounding * 2
    readonly property real roundingY: flatten ? wrapperHeight / 2 : rounding

    preferredRendererType: Shape.CurveRenderer
    opacity: Colours.transparency.enabled ? Colours.transparency.base : 1

    ShapePath {
        strokeWidth: -1
        fillColor: BorderConfig.colour

        startX: root.wrapperWidth

        PathLine {}
        PathArc {
            relativeX: root.rounding
            relativeY: root.roundingY
            radiusX: root.rounding
            radiusY: Math.min(root.rounding, root.wrapperHeight)
        }
        PathLine {
            relativeX: 0
            y: root.flatten ? root.roundingY : root.wrapperHeight - root.rounding
        }
        PathArc {
            relativeX: root.rounding
            relativeY: root.roundingY
            radiusX: root.rounding
            radiusY: Math.min(root.rounding, root.wrapperHeight)
            direction: PathArc.Counterclockwise
        }
        PathLine {
            x: root.wrapperWidth - root.rounding - 1
            relativeY: 0
        }
        PathArc {
            relativeX: root.rounding
            relativeY: root.rounding
            radiusX: root.rounding
            radiusY: root.rounding
        }

        Behavior on fillColor {
            ColorAnimation {
                duration: Appearance.anim.durations.normal
                easing.type: Easing.BezierSpline
                easing.bezierCurve: Appearance.anim.curves.standard
            }
        }
    }
}