fix: show repeated artwork in preview
All checks were successful
Build and deploy / Validate source (push) Successful in 12s
Build and deploy / Publish images and notify Portainer (push) Successful in 1m2s

This commit is contained in:
Cauê Faleiros
2026-09-18 15:14:29 -03:00
parent 2225b70401
commit 56d8fde0db

View File

@@ -372,6 +372,8 @@ h1 em{font-style:normal;color:var(--laranja)}
#vArea .folhaPrevias{min-height:200px;padding:10px;display:grid;gap:12px;background:#F8F9FA}
#vArea .folhaPrevia{margin:0;background:#fff;border:1px solid var(--linha);border-radius:6px;overflow:hidden}
#vArea .folhaPrevia img{width:100%;height:auto;max-height:520px;object-fit:contain;display:block;background:#fff}
#vArea .folhaRepeticoes{display:flex;flex-direction:column;align-items:center;gap:2px;padding:8px;background:#fff}
#vArea .folhaRepeticoes img{width:auto;max-width:100%;object-fit:contain;display:block;background:#fff}
#vArea .folhaPrevia figcaption{padding:7px 9px;font-size:10.5px;color:var(--fraco);border-top:1px solid var(--linha)}
#vArea .semmont{border:0;min-height:200px;display:flex;flex-direction:column;
align-items:center;justify-content:center}
@@ -2512,11 +2514,21 @@ function previaAoVivo(){
const painel=document.createElement('div'); painel.className='folhaPrevias';
previews.forEach((x,index)=>{
const figura=document.createElement('figure'); figura.className='folhaPrevia';
const imagem=new Image(); imagem.src=x.previewSrc; imagem.alt=x.f.name;
const repeticoes=Math.max(1,Math.min(200,x.rep||1));
const sequencia=document.createElement('div'); sequencia.className='folhaRepeticoes';
// The whole printed strip remains visible: repeated sheets are scaled
// together rather than hiding every copy below the panel fold.
const alturaMax=Math.max(48,Math.floor(480/repeticoes));
for(let copia=0;copia<repeticoes;copia++){
const imagem=new Image(); imagem.src=x.previewSrc;
imagem.alt=x.f.name+' · repetição '+(copia+1)+' de '+repeticoes;
imagem.style.maxHeight=alturaMax+'px'; sequencia.append(imagem);
}
const legenda=document.createElement('figcaption');
legenda.textContent=(previews.length>1 ? (index+1)+'. ' : '')+x.f.name+
(x.med ? ' · '+n1(x.med.larg)+' × '+n1(x.med.alt)+' cm' : '');
figura.append(imagem,legenda); painel.append(figura);
(x.med ? ' · '+n1(x.med.larg)+' × '+n1(x.med.alt)+' cm' : '')+
(repeticoes>1 ? ' · '+repeticoes+' repetições em sequência' : '');
figura.append(sequencia,legenda); painel.append(figura);
});
$('vArea').replaceChildren(painel);
}else{