1
0
Fork 0

allow a forced draw on settime

master
Danny 2022-02-04 00:59:53 +01:00
parent ac05df0964
commit c459820105
1 changed files with 10 additions and 5 deletions

View File

@ -67,10 +67,10 @@ class TimeCalClock{
/*
* Run forest run
**/
draw(){
draw(force){
this.drawTime();
if (this.TZOffset===undefined || this.TZOffset!==d.getTimezoneOffset())
if (force || this.TZOffset===undefined || this.TZOffset!==d.getTimezoneOffset())
this.drawDateAndCal();
}
@ -83,8 +83,6 @@ class TimeCalClock{
d=this.date ? this.date : new Date();
const Y=Bangle.appRect.y+this.DATE_FONT_SIZE()+10;
d=d?d :new Date();
g.setFontAlign(0, -1).setFont("Vector", this.TIME_FONT_SIZE()).setColor(g.theme.fg)
.clearRect(Bangle.appRect.x, Y, Bangle.appRect.x2, Y+this.TIME_FONT_SIZE()-7)
.drawString(("0" + require("locale").time(d, 1)).slice(-5), this.centerX, Y, true);
@ -264,4 +262,11 @@ class TimeCalClock{
}
}
timeCalClock = new TimeCalClock(); timeCalClock.draw();
timeCalClock = new TimeCalClock(); timeCalClock.draw();
//hook on settime to redraw immediatly
var _setTime = setTime;
var setTime = function(t) {
_setTime(t);
timeCalClock.draw(true);
};