forked from FOSS/BangleApps
allow a forced draw on settime
parent
ac05df0964
commit
c459820105
|
@ -67,10 +67,10 @@ class TimeCalClock{
|
||||||
/*
|
/*
|
||||||
* Run forest run
|
* Run forest run
|
||||||
**/
|
**/
|
||||||
draw(){
|
draw(force){
|
||||||
this.drawTime();
|
this.drawTime();
|
||||||
|
|
||||||
if (this.TZOffset===undefined || this.TZOffset!==d.getTimezoneOffset())
|
if (force || this.TZOffset===undefined || this.TZOffset!==d.getTimezoneOffset())
|
||||||
this.drawDateAndCal();
|
this.drawDateAndCal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +83,6 @@ class TimeCalClock{
|
||||||
d=this.date ? this.date : new Date();
|
d=this.date ? this.date : new Date();
|
||||||
const Y=Bangle.appRect.y+this.DATE_FONT_SIZE()+10;
|
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)
|
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)
|
.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);
|
.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);
|
||||||
|
};
|
Loading…
Reference in New Issue