From 9ef94430963c3a6ee5994a68240690d8629dbb48 Mon Sep 17 00:00:00 2001 From: Maxim Dolgolyov Date: Tue, 26 May 2026 15:38:37 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D1=82=D1=80=D0=B8=20=D0=B1=D0=B0=D0=B3?= =?UTF-8?q?=D0=B0=20=E2=80=94=20drawGlow=20closure,=20replaceChild=20null?= =?UTF-8?q?=20guard,=20stoich=20text=20overflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/js/labs/opticsbench.js | 9 ++++++++- frontend/js/labs/periodic.js | 1 + frontend/js/labs/stoichiometry.js | 12 ++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/frontend/js/labs/opticsbench.js b/frontend/js/labs/opticsbench.js index 7faf918..7a8b258 100644 --- a/frontend/js/labs/opticsbench.js +++ b/frontend/js/labs/opticsbench.js @@ -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); diff --git a/frontend/js/labs/periodic.js b/frontend/js/labs/periodic.js index 23ccd0f..bb60c88 100644 --- a/frontend/js/labs/periodic.js +++ b/frontend/js/labs/periodic.js @@ -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; } diff --git a/frontend/js/labs/stoichiometry.js b/frontend/js/labs/stoichiometry.js index 3fbfe9a..9a98f85 100644 --- a/frontend/js/labs/stoichiometry.js +++ b/frontend/js/labs/stoichiometry.js @@ -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); }