matdbg: auto-select variant when clicking a material.

The UI was in a weird state after the user selected a new material but
before they had chosen a particular variant. The highlighted
material did not match the content of the source editor.
This commit is contained in:
Philip Rideout
2020-06-30 16:37:03 -07:00
parent 9a58bf2460
commit d7cd247dfc
2 changed files with 6 additions and 2 deletions

View File

@@ -64,7 +64,7 @@ document.querySelector("body").addEventListener("click", (evt) => {
// Handle selection of a material.
if (anchor.classList.contains("material")) {
selectMaterial(anchor.dataset.matid);
selectMaterial(anchor.dataset.matid, true);
return;
}
@@ -206,7 +206,7 @@ function fetchMaterials() {
}
gMaterialDatabase[matInfo.matid] = matInfo;
}
selectMaterial(matJson[0].matid);
selectMaterial(matJson[0].matid, true);
});
}

View File

@@ -24,6 +24,10 @@ a.inactive {
color: #aaa;
}
a.inactive.current {
color: #5af;
}
pre {
font-family: Menlo, Monaco, "Courier New", monospace;
}