More linear progress bar progression

Each cell should receive the same number of ticks
This commit is contained in:
Alexandre Bury 2016-07-25 12:18:05 -07:00
parent 47acf1667d
commit 6c71ac14b0
2 changed files with 2 additions and 3 deletions

View File

@ -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);

View File

@ -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, " ");
});