From 627a20ac7c2636388ce940dbf7af886ec3abb33c Mon Sep 17 00:00:00 2001 From: mrdrogdrog <tilman.vatteroth@udo.edu> Date: Wed, 8 Jul 2015 12:09:20 +0200 Subject: [PATCH] Clock akzeptiert jetzt auch einen transparenten Hintergrund --- panels/clock/script.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/panels/clock/script.js b/panels/clock/script.js index f5f8f26..4d8554f 100755 --- a/panels/clock/script.js +++ b/panels/clock/script.js @@ -18,7 +18,7 @@ this.loaded = function(panel, config) { dbgc = null, afgc = analClock ? analClock.getContext("2d") : null, abgc = null, - bgColor = panel.css("background-color"), + bgColor = null, //panel.css("background-color"), sdColor = "#111", icColor = "#FFF", date = new Date(), @@ -217,6 +217,10 @@ this.loaded = function(panel, config) { } renderDigital = function(h, i, s, t, d, m, y) { + if (bgColor == null) { + dfgc.clearRect(0, 0, digitalWidth, digitalHeight); + } + dfgc.drawImage(digiBackground, 0, 0); dfgc.fillStyle = icColor; if (!seperatorOn) { @@ -236,6 +240,9 @@ this.loaded = function(panel, config) { } renderAnalog = function(h, i, s) { + if (bgColor == null) { + afgc.clearRect(-analogX, -analogY, analogWidth, analogHeight); + } //debugger; afgc.drawImage(analBackground, -analogX, -analogY); afgc.strokeStyle = icColor; @@ -264,8 +271,12 @@ this.loaded = function(panel, config) { } renderDigiBackground = function() { - dbgc.fillStyle = bgColor; - dbgc.fillRect(0, 0, digitalWidth, digitalHeight); + if (bgColor == null) { + dbgc.clearRect(0, 0, digitalWidth, digitalHeight); + } else { + dbgc.fillStyle = bgColor; + dbgc.fillRect(0, 0, digitalWidth, digitalHeight); + } dbgc.fillStyle = sdColor; dbgc.font = fatFont; dbgc.fillText(":", clockSeperatorX, clockSeperatorY); @@ -298,7 +309,12 @@ this.loaded = function(panel, config) { bctx.drawImage(bc, 0, 0, oc.width, oc.height); bc = oc; } - abgc.fillRect(-analogX, -analogY, analogWidth, analogHeight); + + if (bgColor == null) { + abgc.clearRect(-analogX, -analogY, analogWidth, analogHeight); + } else { + abgc.fillRect(-analogX, -analogY, analogWidth, analogHeight); + } abgc.fillStyle = "black"; //abgc.drawImage(buffer, -analogRad, -analogRad, analogRad * 2, analogRad * 2); abgc.drawImage(bc, -analogRad, -analogRad, analogRad * 2, analogRad * 2); -- GitLab