aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2024-08-27 17:33:07 -0700
committerDeterminant <[email protected]>2024-08-27 17:33:07 -0700
commit0cddfa1953a516342b44568bf214ac7103ffe6bb (patch)
treeeb3e4091b5c46c34b9761bf53f1dbe199be6d1e2
parent479d80152a1c3da1a35d66b852934ee4fd7bb5dc (diff)
...
-rwxr-xr-xapp.mjs18
1 files changed, 10 insertions, 8 deletions
diff --git a/app.mjs b/app.mjs
index a5273b3..b3caf0f 100755
--- a/app.mjs
+++ b/app.mjs
@@ -568,15 +568,17 @@ const renderAltimeter = (c, display, values) => {
const vsi = values[1];
const vsi_bg_x = w / 2 + 4;
c.fillRect(vsi_bg_x, 0, w - vsi_bg_x, h);
+ c.fillStyle = "#000";
+ const vsi_h = 20;
+ const vsi_x = vsi_bg_x + 2;
+ const vsi_y =
+ (1 -
+ (Math.min(Math.max(isNumber(vsi) ? vsi : 0, -2000), 2000) + 2000) /
+ 4000) *
+ (h - vsi_h);
+ c.fillRect(vsi_x, vsi_y, w - vsi_x, vsi_h);
+ c.fillStyle = fg;
if (isNumber(vsi)) {
- c.fillStyle = "#000";
- const vsi_h = 20;
- const vsi_x = vsi_bg_x + 2;
- const vsi_y =
- (1 - (Math.min(Math.max(vsi, -2000), 2000) + 2000) / 4000) *
- (h - vsi_h);
- c.fillRect(vsi_x, vsi_y, w - vsi_x, vsi_h);
- c.fillStyle = fg;
c.font = `12px '${labelFont}'`;
c.fillText(Math.trunc(vsi / 10) * 10, vsi_x + 2, vsi_y + vsi_h * 0.8);
}