diff --git a/app/display.html b/app/display.html
index ba5491f..39c180a 100644
--- a/app/display.html
+++ b/app/display.html
@@ -65,13 +65,13 @@
//img.src = src
})
}
- async function setMeter () {
- let body = document.querySelector('body')
+ async function onMeter () {
+ const body = document.querySelector('body')
if (!body.classList.contains('meter')) {
body.classList.add('meter')
}
}
- async function setGrid () {
+ async function onField () {
const can = document.getElementById('can')
const ctx = can.getContext('2d')
if (!can.classList.contains('show')) {
@@ -82,24 +82,27 @@
can.style.width = `${window.innerWidth}px`
can.style.height = `${window.innerHeight}px`
try{
- await drawGrid(can, ctx)
+ await drawField(can, ctx)
} catch (err) {
alert(JSON.stringify(err))
}
}
- async function drawGrid (can, ctx) {
+ // draw a field guide
+ async function drawField (can, ctx) {
const count = 20
const half = Math.round(count / 2)
const w = can.width
const h = can.height
const wsec = w / count
const hsec= h / count
+
ctx.moveTo(w / 2, 0)
ctx.lineTo(w / 2, h)
ctx.stroke()
ctx.moveTo(0, h / 2)
ctx.lineTo(w, h / 2)
ctx.stroke()
+
for (let i = 0; i < count; i++) {
ctx.moveTo(wsec * i, hsec * i)
ctx.lineTo(wsec * i, h - (hsec * i))
@@ -155,6 +158,8 @@
}
}
ipcRenderer.on('display', onDigital)
+ ipcRenderer.on('field', onField)
+ ipcRenderer.on('meter', onMeter)
document.onkeydown = onEscape