Update lib.js
parent
50c17ab3bb
commit
c85c501378
|
|
@ -1,7 +1,8 @@
|
|||
exports.drawClock = function(fontIndex) {
|
||||
var digits = [];
|
||||
if (!require("Storage").read("contourclock-"+Math.abs(parseInt(fontIndex+0.5))+".json")) return (false);
|
||||
var font = JSON.parse(require("Storage").read("contourclock-"+Math.abs(parseInt(fontIndex+0.5))+".json"));
|
||||
fontFile=require("Storage").read("contourclock-"+Math.abs(parseInt(fontIndex+0.5))+".json");
|
||||
if (fontFile==undefined) return(false); //exit if font file not found
|
||||
var font = JSON.parse(fontFile);
|
||||
for (var n in font.characters) {
|
||||
digits.push({width: parseInt(font.characters[n].width),
|
||||
height: font.size,
|
||||
|
|
@ -9,11 +10,10 @@ exports.drawClock = function(fontIndex) {
|
|||
transparent: 1,
|
||||
buffer:E.toArrayBuffer(atob(font.characters[n].buffer))});
|
||||
}
|
||||
if (n!=10) return (false); //font file seems to be invalid
|
||||
var x=0;
|
||||
var y = g.getHeight()/2-digits[0].height/2;
|
||||
var date = new Date();
|
||||
//g.clearRect(0,24,g.getWidth()-1,137);
|
||||
|
||||
g.clearRect(0,38,g.getWidth()-1,138);
|
||||
d1=parseInt(date.getHours()/10);
|
||||
d2=parseInt(date.getHours()%10);
|
||||
|
|
@ -46,4 +46,4 @@ exports.drawClock = function(fontIndex) {
|
|||
g.setBgColor(bg);
|
||||
}
|
||||
return font.name;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue