diff --git a/frontend/js/labs/trigcircle.js b/frontend/js/labs/trigcircle.js index 66406e8..0af8ea6 100644 --- a/frontend/js/labs/trigcircle.js +++ b/frontend/js/labs/trigcircle.js @@ -1169,6 +1169,31 @@ if (typeof window !== 'undefined') window.TrigCircleSim = TrigCircleSim; } function trigEqKey(e) { if (e && (e.key === 'Enter' || e.keyCode === 13)) trigSolve(); } + /* ── Таблица значений (первая четверть) — строится один раз, KaTeX ── */ + function _trigBuildValueTable() { + const el = document.getElementById('trig-table'); + if (!el || el.dataset.built) return; + const cols = [['sin', '#EF476F'], ['cos', '#06D6E0'], ['tg', '#FFD166'], ['ctg', '#7BF5A4']]; + const head = 'α' + + cols.map(([n, c]) => `${n}`).join('') + ''; + const body = [0, 30, 45, 60, 90].map(deg => { + const a = deg * Math.PI / 180, sn = Math.sin(a), cs = Math.cos(a); + const tn = Math.abs(cs) > 1e-9 ? sn / cs : undefined; + const ct = Math.abs(sn) > 1e-9 ? cs / sn : undefined; + const cell = v => `${_tex(_latexVal(v))}`; + return `${deg}°${cell(sn)}${cell(cs)}${cell(tn)}${cell(ct)}`; + }).join(''); + el.innerHTML = `${head}${body}
`; + el.dataset.built = '1'; + } + function trigToggleTable(rowEl) { + const on = rowEl.classList.toggle('active'); + const el = document.getElementById('trig-table'); + if (!el) return; + if (on) { _trigBuildValueTable(); el.style.display = ''; if (trigSim) _trigUpdateUI(trigSim.stats()); } + else el.style.display = 'none'; + } + function _trigUpdateUI(s) { const _f = v => { if (v === undefined) return '—'; @@ -1247,6 +1272,15 @@ if (typeof window !== 'undefined') window.TrigCircleSim = TrigCircleSim; } } + // Подсветка строки таблицы значений (по опорному острому углу) + const tbl = document.getElementById('trig-table'); + if (tbl && tbl.dataset.built && typeof tbl.querySelectorAll === 'function') { + const beta = Math.round(s.refDeg); + tbl.querySelectorAll('tr[data-deg]').forEach(tr => { + tr.style.background = (Number(tr.dataset.deg) === beta) ? 'rgba(155,93,229,0.18)' : ''; + }); + } + // Stats bar — значения тоже KaTeX (дроби/корни) document.getElementById('trigbar-angle').textContent = degStr; setMathVal('trigbar-sin', s.sin); diff --git a/frontend/labs-bodies.html b/frontend/labs-bodies.html index 9dcffdd..f736cc1 100644 --- a/frontend/labs-bodies.html +++ b/frontend/labs-bodies.html @@ -599,6 +599,15 @@
+ + + +
Табличные углы