Merge pull request #3652 from bobrippling/feat/pace-nogps-pause

pace: show elapsed time on pause-screen
pull/3613/head
Rob Pilling 2024-11-11 20:33:44 +00:00 committed by GitHub
commit 5af8c434cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 10 deletions

View File

@ -1 +1,2 @@
0.01: New app!
0.02: Show elapsed time on pause screen

View File

@ -85,26 +85,30 @@
var h = g.getHeight();
var max = splits_1.reduce(function (a, s) { return Math.max(a, s.time); }, 0);
g.setFont("6x8", 2).setFontAlign(-1, -1);
var y = Bangle.appRect.y + barSpacing / 2;
g
.setColor(g.theme.fg)
.drawString(formatDuration_1(exs_1.state.duration), 0, y);
var i = 0;
for (;; i++) {
var split = splits_1[i + splitOffset_1];
if (split == null)
break;
var y_1 = Bangle.appRect.y + i * (barSize + barSpacing) + barSpacing / 2;
var y_1 = Bangle.appRect.y + (i + 1) * (barSize + barSpacing) + barSpacing / 2;
if (y_1 > h)
break;
var size = w * split.time / max;
g.setColor("#00f").fillRect(0, y_1, size, y_1 + barSize);
var splitPace = calculatePace_1(split);
g.setColor(g.theme.fg);
drawSplit_1(i, y_1, splitPace);
}
var pace = exs_1.stats.pacec.getString();
var y = Bangle.appRect.y + i * (barSize + barSpacing) + barSpacing / 2;
y = Bangle.appRect.y + (i + 1) * (barSize + barSpacing) + barSpacing / 2;
drawSplit_1(i, y, pace);
};
var drawSplit_1 = function (i, y, pace) {
g
.setColor(g.theme.fg)
return g
.drawString("".concat(i + 1 + splitOffset_1, " ").concat(typeof pace === "number" ? pace.toFixed(2) : pace), 0, y);
};
var pauseRun_1 = function () {

View File

@ -114,36 +114,40 @@ const drawSplits = () => {
g.setFont("6x8", 2).setFontAlign(-1, -1);
let y = Bangle.appRect.y + barSpacing / 2;
g
.setColor(g.theme.fg)
.drawString(formatDuration(exs.state.duration), 0, y);
let i = 0;
for(; ; i++) {
const split = splits[i + splitOffset];
if (split == null) break;
const y = Bangle.appRect.y + i * (barSize + barSpacing) + barSpacing / 2;
const y = Bangle.appRect.y + (i + 1) * (barSize + barSpacing) + barSpacing / 2;
if (y > h) break;
const size = w * split.time / max; // Scale bar height based on pace
g.setColor("#00f").fillRect(0, y, size, y + barSize);
const splitPace = calculatePace(split); // Pace per km
g.setColor(g.theme.fg)
drawSplit(i, y, splitPace);
}
const pace = exs.stats.pacec.getString();
const y = Bangle.appRect.y + i * (barSize + barSpacing) + barSpacing / 2;
y = Bangle.appRect.y + (i + 1) * (barSize + barSpacing) + barSpacing / 2;
drawSplit(i, y, pace);
};
const drawSplit = (i: number, y: number, pace: number | string) => {
const drawSplit = (i: number, y: number, pace: number | string) =>
g
.setColor(g.theme.fg)
.drawString(
`${i + 1 + splitOffset} ${typeof pace === "number" ? pace.toFixed(2) : pace}`,
0,
y
);
};
const pauseRun = () => {
exs.stop();

View File

@ -1,7 +1,7 @@
{
"id": "pace",
"name": "Pace",
"version": "0.01",
"version": "0.02",
"description": "Show pace and time running splits",
"icon": "app.png",
"tags": "run,running,fitness,outdoors",