From 4be7f9a07cd6f354b506635a02fd8356a4f932db Mon Sep 17 00:00:00 2001 From: Maxim Dolgolyov Date: Wed, 24 Jun 2026 19:45:02 +0300 Subject: [PATCH] =?UTF-8?q?fix(lab-organic):=20=D0=B6=D0=B8=D0=B4=D0=BA?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=20=D0=B2=20=D0=BF=D1=80=D0=BE=D0=B1?= =?UTF-8?q?=D0=B8=D1=80=D0=BA=D0=B5=20=D0=BD=D0=B5=20=D0=B2=D1=8B=D0=BB?= =?UTF-8?q?=D0=B5=D0=B7=D0=B0=D0=B5=D1=82=20=D0=B7=D0=B0=20=D1=81=D1=82?= =?UTF-8?q?=D0=B5=D0=BA=D0=BB=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Клип жидкости был прямоугольник на всю ширину + полукруг — вместе они шире трубки в зоне закруглённого дна, и заливка торчала за стеклом. Заменён на путь по внутреннему контуру пробирки (прямые стенки + дугообразное дно, тем же радиусом w/2-4, что и обводка стекла). Co-Authored-By: Claude Opus 4.8 (1M context) --- frontend/js/labs/organic.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/js/labs/organic.js b/frontend/js/labs/organic.js index 22e4673..d215779 100644 --- a/frontend/js/labs/organic.js +++ b/frontend/js/labs/organic.js @@ -1437,10 +1437,16 @@ class OrganicSim { ctx.lineTo(x + w - 4, y); ctx.stroke(); - // clip to tube for liquid + // clip to the tube interior (straight sides + rounded bottom) so the + // liquid never spills past the glass outline + const rBot = w/2 - 4; ctx.beginPath(); - ctx.rect(x + 4, liqY, w - 8, liqH - 8); - ctx.arc(x + w/2, y + h - (w/2 - 4), w/2 - 4, 0, Math.PI); + ctx.moveTo(x + 4, liqY); + ctx.lineTo(x + 4, y + h - rBot); + ctx.arcTo(x + 4, y + h, x + w/2, y + h, rBot); + ctx.arcTo(x + w - 4, y + h, x + w - 4, y + h - rBot, rBot); + ctx.lineTo(x + w - 4, liqY); + ctx.closePath(); ctx.clip(); // base liquid (reagent color)