fix(labs): SVG markup rendered as text in 6 simulations
Hardcoded inline <svg class="ic"> markers used as arrow replacements (left over from emoji removal) were displayed as raw HTML text where the consumer used textContent or canvas fillText: - chemsandbox: csbar-v5 (Продукты cell) used textContent → SVG visible. Switched to innerHTML for consistency with eq/ionNet cells. Quiz question (qEl.textContent) and answer also receiving SVG — cleaned via _csClean at source. - reactions: modeTxt drawn via canvas fillText — replaced SVG with →. - ionexchange: REACTIONS data + canvas labels — bulk SVG → Unicode arrows. - newton: action button labels used textContent → switched to innerHTML; canvas arrow labels: SVG → Unicode →/↓. - collision: 'KE сохранена' canvas label — SVG checkmark → ✓. - projectile: canvas badges + textContent wind label — SVG → Unicode ←/→/↩. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -277,7 +277,7 @@ class NewtonSim {
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Физика I-B : орбита <svg class="ic" viewBox="0 0 24 24"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg> прямолинейное движение ────────── */
|
||||
/* ── Физика I-B : орбита → прямолинейное движение ────────── */
|
||||
|
||||
_step1B(dt) {
|
||||
const s = this._1B;
|
||||
@@ -804,10 +804,10 @@ class NewtonSim {
|
||||
const alpha = Math.min(1, s.forceFlash * 2.5);
|
||||
const fScale = 72 * alpha;
|
||||
const ny = g.gY - CH - 32;
|
||||
/* Сила на ядро <svg class="ic" viewBox="0 0 24 24"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg> вправо */
|
||||
this._arrow(ctx, s.cx + CW / 2 + 20, ny, s.cx + CW / 2 + 20 + fScale, ny, '#EF476F', 'F<svg class="ic" viewBox="0 0 24 24"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg>ядро', 2.5);
|
||||
/* Реакция на пушку <svg class="ic" viewBox="0 0 24 24"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg> влево */
|
||||
this._arrow(ctx, s.cx - CW / 2 - 20, ny, s.cx - CW / 2 - 20 - fScale, ny, '#4CC9F0', 'F<svg class="ic" viewBox="0 0 24 24"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg>пушка', 2.5);
|
||||
/* Сила на ядро → вправо */
|
||||
this._arrow(ctx, s.cx + CW / 2 + 20, ny, s.cx + CW / 2 + 20 + fScale, ny, '#EF476F', 'F→ядро', 2.5);
|
||||
/* Реакция на пушку → влево */
|
||||
this._arrow(ctx, s.cx - CW / 2 - 20, ny, s.cx - CW / 2 - 20 - fScale, ny, '#4CC9F0', 'F→пушка', 2.5);
|
||||
|
||||
ctx.save(); ctx.globalAlpha = alpha;
|
||||
ctx.font = 'bold 12px sans-serif'; ctx.fillStyle = '#FFD166';
|
||||
@@ -990,7 +990,7 @@ class NewtonSim {
|
||||
}
|
||||
/* Falling after fuel out — show gravity arrow */
|
||||
if (s.fuel <= 0 && !s.stopped) {
|
||||
this._arrow(ctx, rx, ry + 25, rx, ry + 65, '#EF476F', 'mg<svg class="ic" viewBox="0 0 24 24"><line x1="12" y1="5" x2="12" y2="19"/><polyline points="19 12 12 19 5 12"/></svg>', 2.5);
|
||||
this._arrow(ctx, rx, ry + 25, rx, ry + 65, '#EF476F', 'mg↓', 2.5);
|
||||
ctx.font = 'bold 13px sans-serif'; ctx.fillStyle = '#EF476F';
|
||||
ctx.textAlign = 'center'; ctx.fillText('Топливо кончилось — ракета падает!', W / 2, H * 0.15); ctx.textAlign = 'left';
|
||||
}
|
||||
@@ -1009,7 +1009,7 @@ class NewtonSim {
|
||||
ctx.textAlign = 'center'; ctx.fillText('Нажмите «Запуск» для включения двигателя', W / 2, H * 0.50); ctx.textAlign = 'left';
|
||||
}
|
||||
|
||||
this._caption(ctx, 'Газ вниз <svg class="ic" viewBox="0 0 24 24"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg> ракета вверх\n(3-й закон Ньютона)', W, H);
|
||||
this._caption(ctx, 'Газ вниз → ракета вверх\n(3-й закон Ньютона)', W, H);
|
||||
}
|
||||
|
||||
/* ── Вспомогательные рисовалки ──────────────────────────── */
|
||||
@@ -1350,8 +1350,8 @@ function _nwt_lighten(hex, d) {
|
||||
|
||||
// action button label
|
||||
const lbl = sceneData.action || (law === 1 ? '<svg class="ic" viewBox="0 0 24 24"><circle cx="6" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><line x1="20" y1="4" x2="8.12" y2="15.88"/><line x1="14.47" y1="14.48" x2="20" y2="20"/><line x1="8.12" y1="8.12" x2="12" y2="12"/></svg> Нить' : '<svg class="ic" viewBox="0 0 24 24"><polygon points="5 3 19 12 5 21 5 3"/></svg> Действие');
|
||||
document.getElementById('newton-action-label').textContent = lbl;
|
||||
document.getElementById('newton-action-top').textContent = lbl;
|
||||
document.getElementById('newton-action-label').innerHTML = lbl;
|
||||
document.getElementById('newton-action-top').innerHTML = lbl;
|
||||
|
||||
// show/hide sliders
|
||||
document.getElementById('newton-mu-block').style.display = law === 1 && scene === 'A' ? '' : 'none';
|
||||
|
||||
Reference in New Issue
Block a user