Browse Source

Fix subscripts on qvec display

Kirk Trombley 3 năm trước cách đây
mục cha
commit
f8456a4118
1 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 4 4
      nearest.js

+ 4 - 4
nearest.js

@@ -127,8 +127,8 @@ const renderMath = (includeX, normQY, closeCoeff) => {
   return TeXZilla.toMathML(`\\arg\\min_{P}\\left[${xTerm}-${closeCoeff}${qyMod("q")}\\cdot ${qyMod("Y\\left(P\\right)")}\\right]`);
 }
 
-const renderQVec = (q, id) => {
-  document.getElementById(id).innerHTML = TeXZilla.toMathMLString(`\\vec{q}_{\\text{RGB}} = \\left(${q.join(", ")}\\right)`);
+const renderQVec = (q, id, sub) => {
+  document.getElementById(id).innerHTML = TeXZilla.toMathMLString(`\\vec{q}_{\\text{${sub}}} = \\left(${q.join(", ")}\\right)`);
 }
 
 const changePageColors = color => {
@@ -179,8 +179,8 @@ const onUpdate = (event) => {
 
     // Update the color display
     changePageColors(targetColor);
-    renderQVec(targetRGB.map(c => c.toFixed()), "q-vec-rgb");
-    renderQVec(targetJAB.map(c => c.toFixed(2)), "q-vec-jab");
+    renderQVec(targetRGB.map(c => c.toFixed()), "q-vec-rgb", "RGB");
+    renderQVec(targetJAB.map(c => c.toFixed(2)), "q-vec-jab", "Jab");
 
     // Determine metrics from configuration
     const xSelector = includeX ? ({ xRGB, xJAB }) => [ xRGB, xJAB ] : () => [ 0, 0 ];