Files
Learn_System/backend/scripts/patch_optics2.py
Maxim Dolgolyov 5381679c68 chore: консолидация незакоммиченной работы (биохимия + System Health + lab/textbooks)
Зафиксирована накопленная незакоммиченная работа рабочего дерева, КРОМЕ файлов
учебника «Химия 7» (migration 046, chemistry_7_*.html, chem7_svg.js, тест —
оставлены незакоммиченными по запросу).

Включает: модуль биохимии (ядро BIO, 3D VSEPR, химдвижок, баланс, challenges,
пути из БД), System Health Level 1 (вердикт/мониторинг), а также frontend-
страницы и lab/textbooks-правки параллельной сессии.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-30 18:12:55 +03:00

45 lines
2.3 KiB
Python

import sys, os
src = os.path.join(os.path.dirname(__file__), '../../frontend/js/labs/opticsbench.js')
with open(src, 'r', encoding='utf-8') as f:
content = f.read()
# ─────────────────────────────────────────────────────────────────────────────
# PATCH: In MirrorSim.draw(), after _drawFanRays, add aberration fan for _useR mode
# ─────────────────────────────────────────────────────────────────────────────
OLD = (' this._drawFanRays(ctx, mx, ay, f, dPrime, hPrime, showRay, showFill);\n'
' /* spherical aberration overlay (Agent OB-A3) */\n'
' if (this._showSpherical && this.type !== \'flat\' && isFinite(f))\n'
' this._drawMirrorSphericalAberration(ctx, mx, ay, f);\n'
' this._drawMirror(ctx, mx, ay);')
NEW = (' this._drawFanRays(ctx, mx, ay, f, dPrime, hPrime, showRay, showFill);\n'
' /* spherical aberration overlay (Agent OB-A3) */\n'
' if (this._showSpherical && this.type !== \'flat\' && isFinite(f))\n'
' this._drawMirrorSphericalAberration(ctx, mx, ay, f);\n'
' /* Feature 2: parabolic/spherical aberration fan */\n'
' if (this._useR && this.type !== \'flat\' && isFinite(f))\n'
' this._drawAberrationFan(ctx, mx, ay, f);\n'
' this._drawMirror(ctx, mx, ay);\n'
' /* Feature 2: R and f labels on mirror */\n'
' if (this._useR && this.type !== \'flat\' && isFinite(f)) {\n'
' ctx.save();\n'
' ctx.font = \'bold 11px Manrope, system-ui, sans-serif\';\n'
' ctx.fillStyle = \'rgba(6,214,224,0.9)\';\n'
' ctx.textAlign = \'right\'; ctx.textBaseline = \'bottom\';\n'
' ctx.fillText(\'R=\' + this._R.toFixed(0) + \' f=\' + f.toFixed(0), mx - 4, ay - 6);\n'
' ctx.restore();\n'
' }')
if OLD not in content:
print('ERROR: draw fan/mirror block not found'); sys.exit(1)
content = content.replace(OLD, NEW, 1)
with open(src, 'w', encoding='utf-8') as f:
f.write(content)
print('OK lines:', content.count('\n'))