mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-28 04:45:13 +00:00
35 lines
No EOL
1.1 KiB
Text
35 lines
No EOL
1.1 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.0 OR LicenseRef-Slint-commercial
|
|
|
|
import { md } from "md.slint";
|
|
|
|
export component ProgressIndicator {
|
|
private property <float> prog: (progress - minimum) / (maximum - minimum);
|
|
|
|
in property<float> maximum: 100;
|
|
in property<float> minimum: 0;
|
|
in property<float> progress;
|
|
in property <bool> indeterminate;
|
|
|
|
min-height: 4px;
|
|
horizontal-stretch: 1;
|
|
vertical-stretch: 0;
|
|
accessible-role: none;
|
|
accessible-value: root.progress;
|
|
accessible-value-minimum: root.minimum;
|
|
accessible-value-maximum: root.maximum;
|
|
|
|
container := Rectangle {
|
|
background: md.sys.color.surface-variant;
|
|
clip: true;
|
|
|
|
track := Rectangle {
|
|
background: md.sys.color.primary;
|
|
x: !root.indeterminate ? 0px : -parent.width + (parent.width * mod(animation-tick(), 2s) / 1s);
|
|
y: (parent.height - self.height) / 2;
|
|
width: !root.indeterminate ? parent.width * root.prog : parent.width;
|
|
border-radius: container.border-radius;
|
|
}
|
|
}
|
|
|
|
} |