fix: три бага — drawGlow closure, replaceChild null guard, stoich text overflow
This commit is contained in:
@@ -2836,7 +2836,14 @@ class InterferenceSim {
|
||||
|
||||
if (window.LabFX && LabFX.glow && !white) {
|
||||
const r1b = Math.sqrt(0.5 * nm * 1e-6 * R) * scale;
|
||||
LabFX.glow.drawGlow(ctx, cx, cy, r1b, wavelengthToRGB(nm), 18);
|
||||
const ringColor = wavelengthToRGB(nm);
|
||||
LabFX.glow.drawGlow(ctx, function() {
|
||||
ctx.beginPath();
|
||||
ctx.arc(cx, cy, r1b, 0, Math.PI * 2);
|
||||
ctx.strokeStyle = ringColor;
|
||||
ctx.lineWidth = 2;
|
||||
ctx.stroke();
|
||||
}, { color: ringColor, intensity: 18 });
|
||||
}
|
||||
|
||||
ctx.beginPath(); ctx.arc(cx, cy, maxR_mm * scale * 1.05, 0, Math.PI * 2);
|
||||
|
||||
@@ -2728,6 +2728,7 @@ PeriodicTableSim.prototype._switchInteractiveMode = function(modeId) {
|
||||
c.addEventListener('mouseleave', function() { c.style.filter = ''; c.style.transform = ''; c.style.zIndex = ''; });
|
||||
c.addEventListener('click', function() { self._selectElement(z); });
|
||||
})(clone, el.Z);
|
||||
if (!div.parentNode) continue;
|
||||
div.parentNode.replaceChild(clone, div);
|
||||
this._cellMap[el.Z] = clone;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user