Wrap layer selection in labels so clicking text checks box

This commit is contained in:
Chandler Swift 2023-07-04 00:20:13 -05:00
parent bacab31bbc
commit 4167fed59c
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F

View file

@ -32,7 +32,7 @@ for (let category of layerCategories) {
for (let layer of category.layers) { for (let layer of category.layers) {
const li = document.createElement("li"); const li = document.createElement("li");
li.innerHTML = ` li.innerHTML = `
<input type="checkbox" ${layer.enabled ? "checked" : ""}> ${layer.name} <label><input type="checkbox" ${layer.enabled ? "checked" : ""}> ${layer.name}</label>
`; `;
li.querySelector("input").addEventListener("change", function(e){ li.querySelector("input").addEventListener("change", function(e){
if (e.target.checked) { if (e.target.checked) {