From d7cd247dfc0bd3e1b77fa88a217ee33d6d72af05 Mon Sep 17 00:00:00 2001 From: Philip Rideout Date: Tue, 30 Jun 2020 16:37:03 -0700 Subject: [PATCH] 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. --- libs/matdbg/web/script.js | 4 ++-- libs/matdbg/web/style.css | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/matdbg/web/script.js b/libs/matdbg/web/script.js index 78b840b48c..3f2b3e2f22 100644 --- a/libs/matdbg/web/script.js +++ b/libs/matdbg/web/script.js @@ -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); }); } diff --git a/libs/matdbg/web/style.css b/libs/matdbg/web/style.css index 2f638eb86c..252ea83047 100644 --- a/libs/matdbg/web/style.css +++ b/libs/matdbg/web/style.css @@ -24,6 +24,10 @@ a.inactive { color: #aaa; } +a.inactive.current { + color: #5af; +} + pre { font-family: Menlo, Monaco, "Courier New", monospace; }