From 2f4109cb7c0b1980b66fbaa1aae3cea577d9d983 Mon Sep 17 00:00:00 2001 From: Maxim Dolgolyov Date: Fri, 29 May 2026 11:46:22 +0300 Subject: [PATCH] =?UTF-8?q?feat(classroom):=20=D1=80=D0=B8=D1=81=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D1=85=20=D0=BE=D1=82=D0=BA=D1=80=D1=8B=D1=82=D0=BE=D0=B3=D0=BE?= =?UTF-8?q?=20=D1=83=D1=87=D0=B5=D0=B1=D0=BD=D0=B8=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Кнопка «Рисовать» в тулбаре учебника — переиспользует существующий annotate-режим доски (так же, как для симуляций). Переключатель учителя транслируется студентам через тот же SSE-канал /sim/annotate. При закрытии учебника annotate-режим автоматически выключается. --- frontend/classroom.html | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/frontend/classroom.html b/frontend/classroom.html index a8dcc18..6fc8f5a 100644 --- a/frontend/classroom.html +++ b/frontend/classroom.html @@ -2009,7 +2009,8 @@ /* ── Annotate-over-sim mode ───────────────────────────────────────────── */ /* Board floats above the sim panel (sim visible behind transparent canvas) */ - .cr-board-area.annotate-active .cr-sim-panel { z-index: 1; } + .cr-board-area.annotate-active .cr-sim-panel, + .cr-board-area.annotate-active .cr-tb-panel { z-index: 1; } .cr-board-area.annotate-active .cr-board-wrap { z-index: 45; background: transparent !important; @@ -2164,6 +2165,19 @@ display: none; background: transparent; cursor: not-allowed; z-index: 10; } .cr-tb-blocker.active { display: block; } + + /* Draw-over button (in tb-bar; only visible when textbook open) */ + .cr-tb-annotate-btn { + display: none; padding: 5px 10px; border-radius: 99px; + border: 1.5px solid rgba(241,91,181,0.3); background: transparent; + color: rgba(255,255,255,0.7); font-family: 'Manrope',sans-serif; + font-size: 0.72rem; font-weight: 700; cursor: pointer; + transition: all .15s; align-items: center; gap: 4px; margin-right: 4px; + } + .cr-tb-annotate-btn svg { width: 12px; height: 12px; flex-shrink: 0; } + .cr-tb-annotate-btn:hover { color: rgba(255,255,255,0.85); border-color: rgba(241,91,181,0.55); } + .cr-tb-annotate-btn.active { background: rgba(241,91,181,0.18); border-color: rgba(241,91,181,0.55); color: #F15BB5; } + .cr-tb-panel.open .cr-tb-annotate-btn.teacher-ctrl { display: flex; } @@ -2326,6 +2340,10 @@ Учебник + @@ -7107,11 +7125,11 @@ let _annotateTool = 'pencil'; // saved tool before entering annotate mode async function crToggleAnnotate() { - if (!_simActive) return; + if (!_simActive && !_tbActive) return; const isTeacher = _me && (_me.role === 'teacher' || _me.role === 'admin'); const newVal = !_annotateActive; _crApplyAnnotate(newVal); - // Only teacher broadcasts to students + // Only teacher broadcasts to students (reuse sim/annotate channel — same payload) if (isTeacher && _sessionId) { try { await LS.post(`/api/classroom/${_sessionId}/sim/annotate`, { active: newVal }); @@ -7123,10 +7141,12 @@ _annotateActive = active; const boardArea = document.getElementById('cr-board-area'); const simBtn = document.getElementById('cr-sim-annotate-btn'); + const tbBtn = document.getElementById('cr-tb-annotate-btn'); const isTeacher = _me && (_me.role === 'teacher' || _me.role === 'admin'); boardArea?.classList.toggle('annotate-active', active); if (simBtn) simBtn.classList.toggle('active', active); + if (tbBtn) tbBtn.classList.toggle('active', active); if (!_wb) return; _wb.setAnnotateMode(active); @@ -7296,6 +7316,7 @@ } function onTbClose() { + if (_annotateActive) _crApplyAnnotate(false); _tbActive = null; const panel = document.getElementById('cr-tb-panel'); const frame = document.getElementById('cr-tb-frame');