fix: три бага — drawGlow closure, replaceChild null guard, stoich text overflow

This commit is contained in:
Maxim Dolgolyov
2026-05-26 15:38:37 +03:00
parent 7a323f8fe0
commit 9ef9443096
3 changed files with 15 additions and 7 deletions
+6 -6
View File
@@ -177,7 +177,7 @@ class StoichSim {
// Right panel (step-by-step)
this._rightPanel = _stEl('div', {
style: 'flex:0 0 240px;display:flex;flex-direction:column;gap:0;overflow-y:auto;padding:10px 10px;border-left:1px solid rgba(255,255,255,0.07);',
style: 'flex:0 0 260px;min-width:0;display:flex;flex-direction:column;gap:0;overflow-y:auto;overflow-x:hidden;padding:10px 10px;border-left:1px solid rgba(255,255,255,0.07);',
});
main.appendChild(this._rightPanel);
@@ -510,7 +510,7 @@ class StoichSim {
// n = m/M rendered with katex if available
const step1 = `n = \\frac{m}{M} = \\frac{${m.toFixed(2)}}{${re.M}} = ${n.toFixed(4)}\\text{ моль}`;
const step1El = _stEl('div', { style: 'margin-bottom:3px;' });
const step1El = _stEl('div', { style: 'margin-bottom:3px;overflow-x:auto;max-width:100%;font-size:.85rem;' });
_stKatex(step1El, step1);
block.appendChild(step1El);
@@ -530,7 +530,7 @@ class StoichSim {
}));
const limFormula = `n_{\\text{лим}} = ${comp.limitVal.toFixed(4)}\\text{ моль}`;
const limEl = _stEl('div', { style: 'margin-bottom:2px;' });
const limEl = _stEl('div', { style: 'margin-bottom:2px;overflow-x:auto;max-width:100%;font-size:.85rem;' });
_stKatex(limEl, limFormula);
limBlock.appendChild(limEl);
rp.appendChild(limBlock);
@@ -549,16 +549,16 @@ class StoichSim {
// n₂ = (b/a)·n_lim
const ratio = pr.coef + '/' + limRe.coef;
const step1El = _stEl('div', { style: 'margin-bottom:3px;' });
const step1El = _stEl('div', { style: 'margin-bottom:3px;overflow-x:auto;max-width:100%;font-size:.85rem;' });
_stKatex(step1El, `n = \\frac{${pr.coef}}{${limRe.coef}} \\cdot ${comp.limitVal.toFixed(4)} = ${q.n.toFixed(4)}\\text{ моль}`);
block.appendChild(step1El);
const step2El = _stEl('div', { style: 'margin-bottom:3px;' });
const step2El = _stEl('div', { style: 'margin-bottom:3px;overflow-x:auto;max-width:100%;font-size:.85rem;' });
_stKatex(step2El, `m = n \\cdot M = ${q.n.toFixed(4)} \\cdot ${pr.M} = ${q.m.toFixed(3)}\\text{ г}`);
block.appendChild(step2El);
if (pr.phase === 'g') {
const step3El = _stEl('div');
const step3El = _stEl('div', { style: 'overflow-x:auto;max-width:100%;font-size:.85rem;' });
_stKatex(step3El, `V = n \\cdot 22{,}4 = ${q.v.toFixed(3)}\\text{ л}\\,(\\text{н.у.})`);
block.appendChild(step3El);
}