From 4b389d26b1e9f821bd5baeda92a5a1231826f0aa Mon Sep 17 00:00:00 2001 From: James Lyne Date: Mon, 14 Dec 2020 15:57:05 +0000 Subject: [PATCH] Don't try and update digital clock, if it is disabled --- src/leaflet/control/ClockControl.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/leaflet/control/ClockControl.ts b/src/leaflet/control/ClockControl.ts index 5072ad8..ff3f757 100644 --- a/src/leaflet/control/ClockControl.ts +++ b/src/leaflet/control/ClockControl.ts @@ -40,8 +40,6 @@ export class ClockControl extends Control { this._sun.style.transform = 'translate(-150px, -150px)'; this._moon.style.transform = 'translate(-150px, -150px)'; - console.log(sun); - this._sun!.innerHTML = ` @@ -89,16 +87,18 @@ export class ClockControl extends Control { const minecraftTime = Utils.getMinecraftTime(timeOfDay); - if(timeOfDay >= 0) { - this._clock!.classList.remove(minecraftTime.night ? 'day' : 'night'); - this._clock!.classList.add(minecraftTime.day ? 'day' : 'night'); - this._clock!.textContent = [ - minecraftTime.hours.toString().padStart(2, '0'), - minecraftTime.minutes.toString().padStart(2, '0') - ].join(':'); - } else { - this._clock!.classList.remove(minecraftTime.night ? 'day' : 'night'); - this._clock!.textContent = ''; + if (this.options.showDigitalClock) { + if (timeOfDay >= 0) { + this._clock!.classList.remove(minecraftTime.night ? 'day' : 'night'); + this._clock!.classList.add(minecraftTime.day ? 'day' : 'night'); + this._clock!.textContent = [ + minecraftTime.hours.toString().padStart(2, '0'), + minecraftTime.minutes.toString().padStart(2, '0') + ].join(':'); + } else { + this._clock!.classList.remove(minecraftTime.night ? 'day' : 'night'); + this._clock!.textContent = ''; + } } if (this.options.showWeather) {