mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-28 12:54:45 +00:00
30 lines
991 B
Text
30 lines
991 B
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
|
|
|
|
import { CosmicPalette } from "styling.slint";
|
|
|
|
export component ProgressIndicator {
|
|
in property <float> progress;
|
|
in property <bool> indeterminate;
|
|
|
|
min-height: 4px;
|
|
horizontal-stretch: 1;
|
|
vertical-stretch: 0;
|
|
accessible-role: none;
|
|
accessible-value: root.progress;
|
|
|
|
Rectangle {
|
|
clip: true;
|
|
border-radius: 2px;
|
|
background: CosmicPalette.neutral-6-background;
|
|
|
|
track := Rectangle {
|
|
opacity: 0.75;
|
|
width: !root.indeterminate ? parent.width * min(1, max(0, root.progress)) : parent.width;
|
|
height: 100%;
|
|
x: !root.indeterminate ? 0px : -parent.width + (parent.width * mod(animation-tick(), 2s) / 1s);
|
|
border-radius: parent.border-radius;
|
|
background: CosmicPalette.accent-background;
|
|
}
|
|
}
|
|
}
|