Fix #357: Scrollbar margin inconsistency

Completely refactored scrollbar and added proper stepper support
(although they are disabled by default).
pull/361/head
SammysHP 2016-04-18 17:31:59 +02:00
parent 0a2db9eaa1
commit 8d8627a9f5
1 changed files with 52 additions and 79 deletions

View File

@ -4,7 +4,9 @@
@include exports("scrollbar") { @include exports("scrollbar") {
scrollbar { scrollbar {
$_slider_min_length: 20px; $_slider_min_length: 40px;
$_slider_normal_width: 7px;
$_slider_small_width: 4px;
// disable steppers // disable steppers
@at-root * { @at-root * {
@ -15,7 +17,7 @@
background-color: $scrollbar_bg_color; background-color: $scrollbar_bg_color;
transition: 300ms ease-out; transition: 300ms ease-out;
// scrollbar border // scrollbar border on the content side
&.top { border-bottom: 1px solid $borders_color; } &.top { border-bottom: 1px solid $borders_color; }
&.bottom { border-top: 1px solid $borders_color; } &.bottom { border-top: 1px solid $borders_color; }
&.left { border-right: 1px solid $borders_color; } &.left { border-right: 1px solid $borders_color; }
@ -27,135 +29,106 @@
transition: 400ms ease-in; transition: 400ms ease-in;
} }
// slider
slider { slider {
min-width: 7px; min-width: $_slider_normal_width;
min-height: 7px; min-height: $_slider_normal_width;
margin: -2px; border: 1px solid transparent;
border: 4px solid transparent;
border-radius: $roundness; border-radius: $roundness;
background-clip: padding-box; background-clip: padding-box;
background-color: $scrollbar_slider_color; background-color: $scrollbar_slider_color;
&:hover { background-color: $scrollbar_slider_hover_color; } &:hover { background-color: $scrollbar_slider_hover_color; }
&:hover:active { background-color: $scrollbar_slider_active_color; } &:hover:active { background-color: $scrollbar_slider_active_color; }
&:backdrop { background-color: $backdrop_scrollbar_slider_color; } &:backdrop { background-color: $backdrop_scrollbar_slider_color; }
&:disabled { background-color: transparent; } &:disabled { background-color: transparent; }
} }
&.fine-tune { &.horizontal slider { min-width: $_slider_min_length; }
slider { &.vertical slider { min-height: $_slider_min_length; }
min-width: 7px;
min-height: 7px;
}
&.horizontal slider { border-width: 1px; } &.fine-tune slider:active {
&.vertical slider { border-width: 1px; } background-color: lighten($scrollbar_slider_active_color, 10%);
} }
&.overlay-indicator { &.overlay-indicator {
opacity: .8;
&:not(.dragging):not(.hovering) { &:not(.dragging):not(.hovering) {
border-color: transparent; border-color: transparent;
opacity: 0.4; opacity: .4;
background-color: transparent; background-color: transparent;
slider { slider {
margin: 0; min-width: $_slider_small_width;
min-width: 5px; min-height: $_slider_small_width;
min-height: 5px;
background-color: $fg_color; background-color: $fg_color;
border: 1px solid if($variant == 'light', white, black); border: 1px solid if($variant == "light", white, black);
} }
// hide steppers
button { button {
min-width: 5px; min-width: $_slider_small_width;
min-height: 5px; min-height: $_slider_small_width;
background-color: $fg_color; border-color: transparent;
background-clip: padding-box;
border-radius: $roundness;
border: 1px solid if($variant == 'light', white, black);
-gtk-icon-source: none; -gtk-icon-source: none;
} }
&.horizontal { &.horizontal {
slider { slider { min-width: $_slider_min_length; }
margin: 0 2px; button { min-width: $_slider_normal_width; }
min-width: $_slider_min_length;
}
button {
margin: 1px 2px;
min-width: 5px;
}
} }
&.vertical { &.vertical {
slider { slider { min-height: $_slider_min_length; }
margin: 2px 0; button { min-height: $_slider_normal_width; }
min-height: $_slider_min_length;
}
button {
margin: 2px 1px;
min-height: 5px;
}
} }
} }
&.dragging,
&.hovering { opacity: 0.8; }
} }
&.horizontal slider { min-width: $_slider_min_length; } // stepper styling
&.vertical slider { min-height: $_slider_min_length; }
// button styling
button { button {
min-width: $_slider_normal_width;
min-height: $_slider_normal_width;
padding: 0; padding: 0;
min-width: 7px; border: 0;
min-height: 7px; border-radius: 0;
border-style: none; border-color: $borders_color; // FIXME overwritten by global button definition
border-radius: $roundness; background-color: transparent;
transition-property: min-height, min-width, color; box-shadow: none;
color: $scrollbar_slider_color; color: $scrollbar_slider_color;
&:hover { &:hover { color: $scrollbar_slider_hover_color; }
color: $scrollbar_slider_hover_color; &:active, &:checked { color: $scrollbar_slider_active_color; }
} &:backdrop { color: $backdrop_scrollbar_slider_color; }
&:active, &:checked {
color: $scrollbar_slider_active_color;
}
&:backdrop {
color: $backdrop_scrollbar_slider_color;
}
} }
// button icons // button icons
&.vertical { &.vertical {
button { button {
&.down { -gtk-icon-source: -gtk-icontheme('pan-down-symbolic'); } &.down {
-gtk-icon-source: -gtk-icontheme("pan-down-symbolic");
border-top: 1px solid $borders_color;
}
&.up { -gtk-icon-source: -gtk-icontheme('pan-up-symbolic'); } &.up {
-gtk-icon-source: -gtk-icontheme("pan-up-symbolic");
border-bottom: 1px solid $borders_color;
}
} }
} }
&.horizontal { &.horizontal {
button { button {
&.down { -gtk-icon-source: -gtk-icontheme('pan-right-symbolic'); } &.down {
-gtk-icon-source: -gtk-icontheme("pan-right-symbolic");
border-left: 1px solid $borders_color;
}
&.up { -gtk-icon-source: -gtk-icontheme('pan-left-symbolic'); } &.up {
-gtk-icon-source: -gtk-icontheme("pan-left-symbolic");
border-right: 1px solid $borders_color;
}
} }
} }
} }
treeview ~ scrollbar.vertical {
border-top: 1px solid $borders_color;
margin-top: -1px;
}
} }