mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
More linear progress bar progression
Each cell should receive the same number of ticks
This commit is contained in:
parent
47acf1667d
commit
6c71ac14b0
@ -41,8 +41,7 @@ fn main() {
|
||||
|
||||
}))
|
||||
.title("Progress bar example")
|
||||
.padding_top(1)
|
||||
.padding_bottom(1)
|
||||
.padding((0,0,1,1))
|
||||
.with_id("dialog"));
|
||||
|
||||
siv.set_fps(10);
|
||||
|
@ -84,7 +84,7 @@ impl View for ProgressBar {
|
||||
let available = printer.size.x;
|
||||
|
||||
let value = self.value.load(Ordering::Relaxed);
|
||||
let length = (available * (value - self.min)) / (self.max - self.min);
|
||||
let length = ((1 + available) * (value - self.min)) / (1 + self.max - self.min);
|
||||
printer.with_color(ColorStyle::Highlight, |printer| {
|
||||
printer.print_hline((0, 0), length, " ");
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user