Merge pull request #178 from rigrig/barclock

Bar clock: fix SyntaxError
master
Gordon Williams 2020-04-01 14:27:45 +01:00 committed by GitHub
commit 7e2e92afa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -919,7 +919,7 @@
{ "id": "barclock",
"name": "Bar Clock",
"icon": "clock-bar.png",
"version":"0.03",
"version":"0.04",
"description": "A simple digital clock showing seconds as a bar",
"tags": "clock",
"type":"clock",

View File

@ -1,3 +1,4 @@
0.01: Created Bar Clock
0.02: Apply locale, 12-hour setting
0.03: Fix dates drawing over each other at midnight
0.04: Small bugfix

View File

@ -103,7 +103,10 @@
const drawBar = function (date) {
const b = settings.bar
const seconds = date.getSeconds()
if (seconds === 0) return // zero-size rect stills draws one line of pixels
if (seconds === 0) {
// zero-size rect stills draws one line of pixels, we don't want that
return
}
const fraction = seconds / SECONDS_PER_MINUTE,
width = fraction * screen.width
g.setColor(b.color)