summaryrefslogtreecommitdiff
path: root/Redcore-nighttime/gtk-3.0/scss/widgets/_overshoot.scss
blob: 9950eb18906491248b1872bf709a61b00bde1915 (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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
@mixin overshoot($position, $type: normal, $color: $selected_bg_color) {
    $_small_gradient_length: 5%;
    $_big_gradient_length: 100%;

    $_position: center top;
    $_small_gradient_size: 100% $_small_gradient_length;
    $_big_gradient_size: 100% $_big_gradient_length;

    @if $position == bottom {
        $_position: center bottom;
        $_linear_gradient_direction: to top;
    } @else if $position == right {
        $_position: right center;
        $_small_gradient_size: $_small_gradient_length 100%;
        $_big_gradient_size: $_big_gradient_length 100%;
    } @else if $position == left {
        $_position: left center;
        $_small_gradient_size: $_small_gradient_length 100%;
        $_big_gradient_size: $_big_gradient_length 100%;
    }

    $_small_gradient_color: $color;
    $_big_gradient_color: $color;

    $_small_gradient: -gtk-gradient(radial,
                                    $_position, 0,
                                    $_position, .5,
                                    to(alpha($_small_gradient_color, .35)),
                                    to(alpha($_small_gradient_color, .25)));

    $_big_gradient: -gtk-gradient(radial,
                                  $_position, 0,
                                  $_position, .6,
                                  from(alpha($_big_gradient_color, .2)),
                                  to(alpha($_big_gradient_color, 0)));

    @if $type == normal {
        background-image: $_small_gradient, $_big_gradient;
        background-size: $_small_gradient_size, $_big_gradient_size;
    } @else if $type == backdrop {
        background-image: $_small_gradient;
        background-size: $_small_gradient_size;
    }

    background-repeat: no-repeat;
    background-position: $_position;

    background-color: transparent; // reset some properties to be sure to not inherit them somehow
    border: 0;
    box-shadow: none;
}

@mixin undershoot($position) {
    $_undershoot_color_dark: alpha($black, .2);
    $_undershoot_color_light: alpha($white, .2);

    $_gradient_dir: left;
    $_dash_bg_size: 10px 1px;
    $_gradient_repeat: repeat-x;
    $_bg_pos: center $position;

    background-color: transparent; // shouldn't be needed, but better to be sure;

    @if ($position == left) or ($position == right) {
        $_gradient_dir: top;
        $_dash_bg_size: 1px 10px;
        $_gradient_repeat: repeat-y;
        $_bg_pos: $position center;
    }

    /*background-image: linear-gradient(to $_gradient_dir, // this is the dashed line
                                         $_undershoot_color_light 50%,
                                         $_undershoot_color_dark 50%);*/

    padding-#{$position}: 1px;
    background-size: $_dash_bg_size;
    background-repeat: $_gradient_repeat;
    background-origin: content-box;
    background-position: $_bg_pos;
}

// This is used by GtkScrolledWindow, when content is touch-dragged past boundaries.
// This draws a box on top of the content, the size changes programmatically.
.overshoot {
    &.top {
        @include overshoot(top);

        &:backdrop { @include overshoot(top, backdrop); }
    }

    &.bottom {
        @include overshoot(bottom);

        &:backdrop { @include overshoot(bottom, backdrop); }
    }

    &.left {
        @include overshoot(left);

        &:backdrop { @include overshoot(left, backdrop); }
    }

    &.right {
        @include overshoot(right);

        &:backdrop { @include overshoot(right, backdrop); }
    }
}

// Overflow indication, works similarly to the overshoot, the size if fixed tho.
.undershoot {
    &.top { @include undershoot(top); }

    &.bottom { @include undershoot(bottom); }

    &.left { @include undershoot(left); }

    &.right { @include undershoot(right); }
}