refactor: distribute lab-init.js into 34 engine files

lab-init.js: 4098 -> 543 lines (infrastructure + THEORY only)

Each sim's _open*() + UI helpers moved to its engine file:
graph.js, projectile.js, collision.js, magnetic.js, triangle.js,
geometry.js, trigcircle.js, gas.js (molphys), coulomb.js, circuit.js,
reactions.js (chemistry), newton.js (dynamics), chemsandbox.js,
celldivision.js, photosynthesis.js, angrybirds.js, quadratic.js,
normaldist.js, graphtransform.js, pendulum.js, equilibrium.js,
thinlens.js, mirror.js, isoprocess.js, titration.js, refraction.js,
probability.js, bohratom.js, electrolysis.js, waves.js,
crystal.js, orbitals.js, stereo.js, hydrostatics.js

All 34 engine files syntax-checked OK.
This commit is contained in:
Maxim Dolgolyov
2026-05-08 14:54:54 +03:00
parent d5f77bb648
commit ae31e4c4e8
35 changed files with 3657 additions and 3589 deletions
+24 -1
View File
@@ -1,4 +1,4 @@
'use strict';
'use strict';
/* ═══════════════════════════════════════════════
CrystalSim — 3D crystal lattice (Three.js)
@@ -313,3 +313,26 @@ class CrystalSim {
this.renderer.render(this.scene, this.camera);
}
}
/* ─── lab UI init ─────────────────────────────────── */
var crystalSim = null;
function _openCrystal() {
document.getElementById('sim-topbar-title').textContent = 'Кристаллическая решётка';
_simShow('sim-crystal');
requestAnimationFrame(() => requestAnimationFrame(() => {
if (!crystalSim) {
crystalSim = new CrystalSim(document.getElementById('crystal-container'));
} else {
crystalSim.fit();
crystalSim.play();
}
}));
}
function setCrystal(type, btn) {
document.querySelectorAll('.crystal-type-btn').forEach(b => { b.classList.remove('active'); b.style.borderColor = ''; b.style.color = ''; });
btn.classList.add('active');
btn.style.borderColor = '#9B5DE5'; btn.style.color = '#9B5DE5';
if (crystalSim) crystalSim.setLattice(type);
}
/* ── molecular orbitals (3D) ── */