From c9eea41bbe832e0233bace45f577a3575fd97e2c Mon Sep 17 00:00:00 2001 From: Roman Buryan Date: Wed, 18 Nov 2026 21:16:33 +0300 Subject: [PATCH] [PRISM] Heatmap: fetch selected model specs, async render --- ops/work/web/studio.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ops/work/web/studio.html b/ops/work/web/studio.html index 9cc3657..a1c929c 100644 --- a/ops/work/web/studio.html +++ b/ops/work/web/studio.html @@ -219,10 +219,11 @@ async function loadHeat(){ drawHeat(); } function showHeat(){ if(!S.product) return; setView('heat'); setTimeout(()=>{ const sel=$('#heatdevice'); if(sel) sel.value=S.product.name; drawHeat(); },50); } -function drawHeat(){ +async function drawHeat(){ const c=$('#heatcanvas'); if(!c) return; const ctx=c.getContext('2d'); const W=Math.max(2,parseFloat($('#heatw').value)||6), D=Math.max(2,parseFloat($('#heatd').value)||5); - const name=$('#heatdevice').value; const p=(S.heatItems||[]).find(x=>x.name===name) || (S.product&&S.product.name===name?S.product:null); + const name=$('#heatdevice').value; let p=(S.heatItems||[]).find(x=>x.name===name) || (S.product&&S.product.name===name?S.product:null); + if(p && !p.specs){ try { const r=await api('/api/product?key='+encodeURIComponent(p.name)); p=r.product||p; } catch(e){} } const pad=36, availW=c.width-pad*2, availH=c.height-pad*2; const scale=Math.min(availW/W, availH/D); const rw=W*scale, rh=D*scale, x0=(c.width-rw)/2, y0=(c.height-rh)/2; ctx.clearRect(0,0,c.width,c.height); ctx.fillStyle='#0d1117'; ctx.fillRect(0,0,c.width,c.height);