Fix visibility of lights
This commit is contained in:
parent
cfc72396af
commit
8af63207d8
|
@ -25,12 +25,15 @@ function drawLight(available, light_id, light_label, room_id, room_label) {
|
||||||
if (available == true) {
|
if (available == true) {
|
||||||
green = "#00f300" //turned on
|
green = "#00f300" //turned on
|
||||||
red = "#570000" //turned off
|
red = "#570000" //turned off
|
||||||
|
red = "rgba(87, 00, 00, 0.2"
|
||||||
} else {
|
} else {
|
||||||
green = "#003000"
|
green = "#0030004D"
|
||||||
|
green = "rgba(00, 48, 00, 0.2"
|
||||||
red = "#cc0000"
|
red = "#cc0000"
|
||||||
}
|
}
|
||||||
cxt.strikeStyle = "#999999";
|
cxt.strikeStyle = "#FFFFFF";
|
||||||
cxt.lineWidth = 3;
|
|
||||||
|
cxt.lineWidth = 6;
|
||||||
|
|
||||||
// Draw green light
|
// Draw green light
|
||||||
cxt.beginPath()
|
cxt.beginPath()
|
||||||
|
@ -51,13 +54,14 @@ function createOrGetLight(light_id, light_label, room_id, room_label) {
|
||||||
light = document.querySelectorAll(".trafficLight." + light_id)
|
light = document.querySelectorAll(".trafficLight." + light_id)
|
||||||
if (typeof room_id !== 'undefined') {
|
if (typeof room_id !== 'undefined') {
|
||||||
roomContainer = createOrGetRoomContainer(room_id, room_label)
|
roomContainer = createOrGetRoomContainer(room_id, room_label)
|
||||||
|
lightsContainer = roomContainer.getElementsByClassName("lights")[0]
|
||||||
}
|
}
|
||||||
if (light.length > 0) {
|
if (light.length > 0) {
|
||||||
return light[0]
|
return light[0]
|
||||||
} else {
|
} else {
|
||||||
light = createLight(light_id, light_label)
|
light = createLight(light_id, light_label)
|
||||||
if (typeof room_id !== 'undefined') {
|
if (typeof room_id !== 'undefined') {
|
||||||
roomContainer.appendChild(light)
|
lightsContainer.appendChild(light)
|
||||||
} else {
|
} else {
|
||||||
document.body.appendChild(light)
|
document.body.appendChild(light)
|
||||||
}
|
}
|
||||||
|
@ -74,7 +78,7 @@ function createLight(id, labelText) {
|
||||||
label.innerHTML = labelText
|
label.innerHTML = labelText
|
||||||
trafficLight.appendChild(label)
|
trafficLight.appendChild(label)
|
||||||
canvas = document.createElement("canvas")
|
canvas = document.createElement("canvas")
|
||||||
canvas.classList.add("lights")
|
canvas.classList.add("light")
|
||||||
trafficLight.appendChild(canvas)
|
trafficLight.appendChild(canvas)
|
||||||
|
|
||||||
return trafficLight
|
return trafficLight
|
||||||
|
|
|
@ -60,8 +60,11 @@ function createRoomContainer(room_id, room_label) {
|
||||||
roomContainer.classList.add(room_id)
|
roomContainer.classList.add(room_id)
|
||||||
label = document.createElement("div")
|
label = document.createElement("div")
|
||||||
label.classList.add("label")
|
label.classList.add("label")
|
||||||
label.innerHTML = "Raum " + room_label
|
label.innerHTML = "Zimmer " + room_label
|
||||||
|
light = document.createElement("div")
|
||||||
|
light.classList.add("lights")
|
||||||
roomContainer.appendChild(label)
|
roomContainer.appendChild(label)
|
||||||
|
roomContainer.appendChild(light)
|
||||||
|
|
||||||
return roomContainer
|
return roomContainer
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
<head>
|
<head>
|
||||||
<title>Anzeige</title>
|
<title>Anzeige</title>
|
||||||
<style>
|
<style>
|
||||||
|
html {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
@ -53,9 +58,13 @@
|
||||||
margin-bottom: 1%;
|
margin-bottom: 1%;
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.lights {
|
canvas.light {
|
||||||
background-color: gray;
|
background-color: #4b4b4b;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.lights {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue