Don't try and update digital clock, if it is disabled

This commit is contained in:
James Lyne 2020-12-14 15:57:05 +00:00
parent 4124b6b8e8
commit 4b389d26b1

View File

@ -40,8 +40,6 @@ export class ClockControl extends Control {
this._sun.style.transform = 'translate(-150px, -150px)'; this._sun.style.transform = 'translate(-150px, -150px)';
this._moon.style.transform = 'translate(-150px, -150px)'; this._moon.style.transform = 'translate(-150px, -150px)';
console.log(sun);
this._sun!.innerHTML = ` this._sun!.innerHTML = `
<svg class="svg-icon" viewBox="${sun.viewBox}"> <svg class="svg-icon" viewBox="${sun.viewBox}">
<use xlink:href="${sun.url}" /> <use xlink:href="${sun.url}" />
@ -89,16 +87,18 @@ export class ClockControl extends Control {
const minecraftTime = Utils.getMinecraftTime(timeOfDay); const minecraftTime = Utils.getMinecraftTime(timeOfDay);
if(timeOfDay >= 0) { if (this.options.showDigitalClock) {
this._clock!.classList.remove(minecraftTime.night ? 'day' : 'night'); if (timeOfDay >= 0) {
this._clock!.classList.add(minecraftTime.day ? 'day' : 'night'); this._clock!.classList.remove(minecraftTime.night ? 'day' : 'night');
this._clock!.textContent = [ this._clock!.classList.add(minecraftTime.day ? 'day' : 'night');
minecraftTime.hours.toString().padStart(2, '0'), this._clock!.textContent = [
minecraftTime.minutes.toString().padStart(2, '0') minecraftTime.hours.toString().padStart(2, '0'),
].join(':'); minecraftTime.minutes.toString().padStart(2, '0')
} else { ].join(':');
this._clock!.classList.remove(minecraftTime.night ? 'day' : 'night'); } else {
this._clock!.textContent = ''; this._clock!.classList.remove(minecraftTime.night ? 'day' : 'night');
this._clock!.textContent = '';
}
} }
if (this.options.showWeather) { if (this.options.showWeather) {