Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std-widgets: fixed arrow size of scroll bar button #6728

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions internal/compiler/widgets/fluent/scrollview.slint
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { FluentPalette, Icons } from "styling.slint";

component ScrollViewButton inherits TouchArea {
in property <image> icon;
in property <bool> horizontal;

width: 8px;
height: 8px;
width: root.horizontal ? 6px : 8px;
height: root.horizontal ? 8px : 6px;

icon := Image {
x: (parent.width - self.width) / 2;
Expand All @@ -23,7 +24,7 @@ component ScrollViewButton inherits TouchArea {
states [
pressed when root.pressed : {
opacity: 1;
icon.width: 6px;
icon.width: root.width - 2px;
}
hover when root.has-hover : {
opacity: 1;
Expand Down Expand Up @@ -109,6 +110,7 @@ component ScrollBar inherits Rectangle {
x: !root.horizontal ? (parent.width - self.width) / 2 : 4px;
y: root.horizontal ? (parent.height - self.height) / 2 : 4px;
icon: root.horizontal ? Icons.left : Icons.up;
horizontal: root.horizontal;

clicked => {
root.value = min(0px, root.value + root.step-size);
Expand All @@ -120,6 +122,7 @@ component ScrollBar inherits Rectangle {
x: !root.horizontal ? (parent.width - self.width) / 2 : root.width - self.width - 4px;
y: root.horizontal ? (parent.height - self.height) / 2 : root.height - self.height - 4px;
icon: root.horizontal ? Icons.right : Icons.down;
horizontal: root.horizontal;

clicked => {
root.value = max(-root.maximum, root.value - root.step-size);
Expand Down Expand Up @@ -165,15 +168,15 @@ export component ScrollView {
width: 14px;
x: flickable.width + flickable.x - self.width;
y: flickable.y;
height: flickable.height;
height: flickable.height - horizontal-bar.height;
horizontal: false;
maximum: flickable.viewport-height - flickable.height;
page-size: flickable.height;
}

horizontal-bar := ScrollBar {
enabled: root.enabled;
width: flickable.width;
width: flickable.width - vertical-bar.width;
height: 14px;
y: flickable.height + flickable.y - self.height;
x: flickable.x;
Expand Down
Loading