Do not show widget at wrong position

Better readability of IF statement
master
Marco Heiming 2022-06-28 08:41:12 +02:00
parent 11507d5eb4
commit 579e57f82e
1 changed files with 2 additions and 2 deletions

View File

@ -73,7 +73,7 @@ function showAlarm(body, key, type) {
*/ */
function doWeNeedToAlarm(key) { function doWeNeedToAlarm(key) {
const tsNow = Math.round(Date.now() / 1000); // seconds const tsNow = Math.round(Date.now() / 1000); // seconds
return setting(key) == undefined || setting(key) == 0 || setting(key) < tsNow; return setting(key) == undefined || setting(key) == 0 || tsNow > setting(key);
} }
function isValidPressureValue(pressure) { function isValidPressureValue(pressure) {
@ -262,7 +262,7 @@ function draw() {
} }
g.reset(); g.reset();
if (this.x == undefined) if (this.x == undefined || this.y != 0)
return; // widget not yet there return; // widget not yet there
g.clearRect(this.x, this.y, this.x + this.width - 1, this.y + 23); g.clearRect(this.x, this.y, this.x + this.width - 1, this.y + 23);