From a642ec07b1f6008d3a47ec01bde18ac6e73e4acb Mon Sep 17 00:00:00 2001 From: MaBecker Date: Sat, 9 Nov 2019 16:31:14 +0100 Subject: [PATCH] switch font and stay out of widget area --- apps/clock-word.js | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/apps/clock-word.js b/apps/clock-word.js index a7968b577..5a090feef 100644 --- a/apps/clock-word.js +++ b/apps/clock-word.js @@ -39,16 +39,15 @@ }; // offsets and incerments - const xs = 30; - const ys = 20; + const xs = 35; + const ys = 31; const dy = 22; const dx = 25; // font size and color - const wordFontSize = 20; - const timeFontSize = 30; - const passivColor = 0x3186/*grey*/; - const activeColor = 0xF800/*red*/; + const fontSize = 3; // "6x8" + const passivColor = 0x3186 /*grey*/ ; + const activeColor = 0xF800 /*red*/ ; function drawWordClock() { @@ -60,9 +59,9 @@ var hidx; var midx; - var midxA=[]; + var midxA = []; - g.setFontVector(wordFontSize); + g.setFont("6x8",fontSize); g.setColor(passivColor); g.setFontAlign(0, -1, 0); @@ -79,7 +78,6 @@ y += dy; }); - // calc indexes midx = Math.round(m / 5); hidx = h % 12; @@ -95,15 +93,13 @@ midxA = [12 - midx, 7]; } } - + // write hour in active color g.setColor(activeColor); - g.setFontVector(wordFontSize); - hours[hidx][0].split('').forEach((c, pos) => { x = xs + (hours[hidx][pos + 1] / 10 | 0) * dx; y = ys + (hours[hidx][pos + 1] % 10) * dy; - + g.drawString(c, x, y); }); @@ -118,9 +114,8 @@ // display digital time g.setColor(activeColor); - g.setFontVector(timeFontSize); - g.clearRect(0,200,240,240); - g.drawString(time, 120, 200); + g.clearRect(0, 215, 240, 240); + g.drawString(time, 120, 215); } Bangle.on('lcdPower', function(on) {