widclkscrl: draw without args

master
Erik Andresen 2023-07-25 23:35:32 +02:00
parent 9ea1fe4dcf
commit 7625421a51
1 changed files with 3 additions and 3 deletions

View File

@ -16,14 +16,14 @@
pos: 10, pos: 10,
dir: -1, dir: -1,
eventHandlerSet: false, eventHandlerSet: false,
draw: function(_w, scroll) { draw: function() {
if (!this.eventHandlerSet) { if (!this.eventHandlerSet) {
Bangle.on('lock', (on) => { Bangle.on('lock', (on) => {
this.run(!on); this.run(!on);
}); });
this.eventHandlerSet = true; this.eventHandlerSet = true;
} }
if (scroll) { if (this.text) {
const buf = Graphics.createArrayBuffer(WIDTH,24,1,{msb:true}).setFont("Teletext5x9Ascii:1x2").setFontAlign(-1, 0); const buf = Graphics.createArrayBuffer(WIDTH,24,1,{msb:true}).setFont("Teletext5x9Ascii:1x2").setFontAlign(-1, 0);
buf.drawString(this.text, this.pos, 12); buf.drawString(this.text, this.pos, 12);
@ -50,7 +50,7 @@
if (!Bangle.CLOCK && on && !this.interval) { if (!Bangle.CLOCK && on && !this.interval) {
this.text = getDateText(); this.text = getDateText();
this.interval = setInterval(() => { this.interval = setInterval(() => {
this.draw(this, true); this.draw();
}, 100); }, 100);
this.width = WIDTH+2; Bangle.drawWidgets(); this.width = WIDTH+2; Bangle.drawWidgets();
} else if (!on && this.interval) { } else if (!on && this.interval) {