Update app.js

Fix progress bar drawing.
pull/1612/head
Andrew Gregory 2022-03-23 16:18:21 +08:00 committed by GitHub
parent b26d341609
commit bf30b35ac0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -188,15 +188,16 @@ function drawProgressBar() {
let y2 = y1 + TOKEN_HEIGHT - 1; let y2 = y1 + TOKEN_HEIGHT - 1;
if (y2 >= AR.y && y1 <= AR.y2) { if (y2 >= AR.y && y1 <= AR.y2) {
// token visible // token visible
if ((y2 - 3) <= AR.y2) y1 = y2 - 3;
if (y1 <= AR.y2)
{ {
// progress bar visible // progress bar visible
y2 = Math.min(y2, AR.y2); y2 = Math.min(y2, AR.y2);
let xr = Math.floor(AR.w * rem / tokens[id].period) + AR.x; let xr = Math.floor(AR.w * rem / tokens[id].period) + AR.x;
g.setColor(g.theme.fgH) g.setColor(g.theme.fgH)
.setBgColor(g.theme.bgH) .setBgColor(g.theme.bgH)
.fillRect(AR.x, y2 - 3, xr, y2) .fillRect(AR.x, y1, xr, y2)
.clearRect(xr + 1, y2 - 3, AR.x2, y2); .clearRect(xr + 1, y1, AR.x2, y2);
} }
} else { } else {
// token not visible // token not visible