Skip to content
Snippets Groups Projects
Commit d7607f64 authored by Tilman Vatteroth's avatar Tilman Vatteroth :robot:
Browse files

uhrenladefehler in firefox behoben. aktuelle firefoxversionen können kein svg...

uhrenladefehler in firefox behoben. aktuelle firefoxversionen können kein svg auf ein canvas zeichnen
parent 01326a74
Branches
No related tags found
No related merge requests found
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -5,7 +5,7 @@ this.loaded = function(panel, config) { ...@@ -5,7 +5,7 @@ this.loaded = function(panel, config) {
var DigitalCanvasClock = function() { var DigitalCanvasClock = function() {
var var
me = this, me = this,
analBGFile = "panels/clock/background.svg", analBGFile = "panels/clock/background.png",
analBGImg = new Image(), analBGImg = new Image(),
analogFactor = 0.9, analogFactor = 0.9,
useBackground = true, useBackground = true,
...@@ -57,10 +57,12 @@ this.loaded = function(panel, config) { ...@@ -57,10 +57,12 @@ this.loaded = function(panel, config) {
smlFontPost = "time-medium"; // width * 18.75% smlFontPost = "time-medium"; // width * 18.75%
init = function() { init = function() {
if (fontsReady) { if (fontsReady) {
digiBackground = document.createElement('canvas'); digiBackground = document.createElement('canvas');
analBackground = document.createElement('canvas'); analBackground = document.createElement('canvas');
me.resize($(panel).width(), $(panel).height()); me.resize($(panel).width(), $(panel).height());
loop(); loop();
} else { } else {
setTimeout(init,0); setTimeout(init,0);
...@@ -119,8 +121,10 @@ this.loaded = function(panel, config) { ...@@ -119,8 +121,10 @@ this.loaded = function(panel, config) {
} }
calc = function() { calc = function() {
if (!!digiClock) calcDigital(); if (!!digiClock) calcDigital();
if (!!analClock) calcAnalog(); if (!!analClock) calcAnalog();
} }
calcDigital = function() { calcDigital = function() {
...@@ -165,6 +169,7 @@ this.loaded = function(panel, config) { ...@@ -165,6 +169,7 @@ this.loaded = function(panel, config) {
} }
calcAnalog = function() { calcAnalog = function() {
analogWidth = $(analClock).width(); analogWidth = $(analClock).width();
analogHeight = $(analClock).height(); analogHeight = $(analClock).height();
// clock size // clock size
...@@ -183,6 +188,7 @@ this.loaded = function(panel, config) { ...@@ -183,6 +188,7 @@ this.loaded = function(panel, config) {
analBackground.height = analogHeight; analBackground.height = analogHeight;
abgc = analBackground.getContext("2d"); abgc = analBackground.getContext("2d");
abgc.translate(analogX, analogY); abgc.translate(analogX, analogY);
renderAnalBackground(); renderAnalBackground();
} }
...@@ -279,7 +285,9 @@ this.loaded = function(panel, config) { ...@@ -279,7 +285,9 @@ this.loaded = function(panel, config) {
abgc.fillStyle = bgColor; abgc.fillStyle = bgColor;
abgc.fillRect(-analogX, -analogY, analogWidth, analogHeight); abgc.fillRect(-analogX, -analogY, analogWidth, analogHeight);
abgc.fillStyle = "black"; abgc.fillStyle = "black";
console.log(analBGImg);
abgc.drawImage(analBGImg, -analogRad, -analogRad, analogRad * 2, analogRad * 2); abgc.drawImage(analBGImg, -analogRad, -analogRad, analogRad * 2, analogRad * 2);
} }
analBGImg.onload = function() { analBGImg.onload = function() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment