Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
fixed issue where Bad Connection error will popup, but previous text stayed in the canvas off screen
  • Loading branch information
f00d4tehg0dz committed Aug 21, 2022
1 parent 463f3d6 commit 790c477
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Binary file modified Release/com.f00d4tehg0dz.teslafi.streamDeckPlugin
Binary file not shown.
12 changes: 11 additions & 1 deletion com.f00d4tehg0dz.teslafi.sdPlugin/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if ($SD) {
Object.assign(clonedSettings, settings);
setTitleWithTeslaFiStatus(context, clonedSettings);
},
moment.duration(1, 'hours').asMilliseconds());
moment.duration(15, 'minutes').asMilliseconds());
}

function setTitleWithTeslaFiStatus(context, settings) {
Expand All @@ -73,6 +73,13 @@ if ($SD) {
const unquoted = removeBracket.replace(/\"/g, "");
const comma = unquoted.replace(/,/g, "");

function clearCanvas(context, canvas) {
context.clearRect(0, 0, canvas.width, canvas.height);
var w = canvas.width;
canvas.width = 1;
canvas.width = w;
}

// load bg-image
ctx = canvas.getContext("2d");
img = document.getElementById("bg");
Expand Down Expand Up @@ -102,6 +109,9 @@ if ($SD) {
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.drawImage(img, 144, 144);

// Create Canvas Image
clearCanvas(context, canvas)
for (var i = 0; i<lines.length; i++)
ctx.fillText(lines[i], x, y + (i*lineheight) );
$SD.api.setTitle(context, '', null);
Expand Down

0 comments on commit 790c477

Please sign in to comment.