mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
std-widgets: fixed arrow size of scroll bar button (#6728)
This commit is contained in:
parent
e854e11399
commit
2cb5fb1d99
1 changed files with 8 additions and 5 deletions
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -165,7 +168,7 @@ 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;
|
||||
|
@ -173,7 +176,7 @@ export component ScrollView {
|
|||
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue