2022-01-12 22:45:42 +00:00
|
|
|
Bangle.on('step', function(s) { WIDGETS["widpa"].draw(); });
|
|
|
|
Bangle.on('lcdPower', function(on) {
|
|
|
|
if (on) WIDGETS["widpa"].draw();
|
|
|
|
});
|
2022-01-19 22:45:16 +00:00
|
|
|
WIDGETS["widpa"]={area:"tl",sortorder:-1,width:13,draw:function() {
|
2022-01-12 22:45:42 +00:00
|
|
|
if (!Bangle.isLCDOn()) return; // dont redraw if LCD is off
|
|
|
|
var steps = Bangle.getHealthStatus("day").steps;
|
|
|
|
var w = 1 + (steps.toString().length)*12;
|
2022-01-13 18:58:22 +00:00
|
|
|
if (w != this.width) {this.width = w; setTimeout(() => Bangle.drawWidgets(),10); return;}
|
2022-01-12 22:45:42 +00:00
|
|
|
g.reset();
|
|
|
|
g.setColor(g.theme.bg);
|
|
|
|
g.fillRect(this.x, this.y, this.x + this.width, this.y + 23);
|
|
|
|
g.setColor(g.theme.fg);
|
|
|
|
g.setFont('6x8',2);
|
|
|
|
g.setFontAlign(-1, 0);
|
|
|
|
g.drawString(steps, this.x, this.y + 12);
|
|
|
|
}};
|