feat: the Site cuts the empty strips at the top and bottom of a ready PNG sheet from price and print
Some checks failed
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Failing after 7m43s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Has been skipped
Some checks failed
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Failing after 7m43s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Has been skipped
Step 2 of trimming empty strips (Marcus, 2026-11-18): the Site.
- The sheet check finds where the ink starts and ends (each map cell
keeps its first and last ink row) and returns the empty strips.
- A ready PNG sheet whose strip passes 1 cm loses it but for 0,5 cm, as
the layout keeps; its metres drop to what is left, and the cart sends
trim_top_cm and trim_bottom_cm with the source, which the server prints
without (06f4ec9). Spaces between artworks stay.
- The sheet's card says "Removemos N cm vazios do fim do arquivo.
Cobrado: X m." (with several sheets or copies: "Esta folha fica com
X m.").
- The thinnest stroke's place for the proof counts from where the cut
starts.
Checked in Chromium against the page: a 100 cm UV sheet with art from 20
to 45 cm leaves 25,98 cm, a 3 m sheet (the tall-PNG path) 71 cm, two
sheets each say their own metres; the cart's production passes the
server model and prints 25,98 cm with the art whole.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -61,6 +61,19 @@ I.addEventListener('change',()=>sel([...I.files]));
|
||||
// Each file's upload, under the uploader (Dropstar, 2026-10-29): the bytes
|
||||
// sent of its size, then the security check; a failure says why. It starts
|
||||
// as soon as the file is on the page (checkout.js sends it).
|
||||
// Faixas vazias no começo e no fim de uma folha pronta em PNG saem do preço e
|
||||
// da impressão (Marcus, 18/11/2026). Fica 0,5 cm de margem, como na montagem,
|
||||
// e só se corta faixa de mais de 1 cm. O servidor imprime só o que sobra.
|
||||
const CORTE_MARGEM_CM=0.5, CORTE_MINIMO_CM=1;
|
||||
function aplicaCorte(x){
|
||||
x.corte=null;
|
||||
if(!x.med||!x.an||!/\.png$/i.test(x.f.name)) return;
|
||||
const corta=v=>v>CORTE_MINIMO_CM ? +(v-CORTE_MARGEM_CM).toFixed(2) : 0;
|
||||
const topo=corta(x.an.vazioTopoCm||0), fim=corta(x.an.vazioFimCm||0);
|
||||
if(!(topo||fim) || topo+fim>=x.med.alt) { x.m=x.med.alt/100; return; }
|
||||
x.corte={topo, fim};
|
||||
x.m=+((x.med.alt-topo-fim)/100).toFixed(4);
|
||||
}
|
||||
const ENVIADO_MS=4000;
|
||||
const enviadoEm=new WeakMap();
|
||||
// A few repaints a second, page in view or not: progress comes in far more often.
|
||||
@@ -165,7 +178,7 @@ async function sel(fs){
|
||||
// On their way at once; a JPG is refused at the order anyway.
|
||||
fs.filter(f=>!/\.jpe?g$/i.test(f.name)).forEach(f=>window.dtfEnvio?.enviar(f));
|
||||
if(ehFolha()){
|
||||
const novas=fs.map(f=>({f, med:null, rep:1, m:0, semAnalise:null, analiseInicio:Date.now()}));
|
||||
const novas=fs.map(f=>({f, med:null, rep:1, m:0, corte:null, semAnalise:null, analiseInicio:Date.now()}));
|
||||
folhas=folhas.concat(novas); // soma, não substitui
|
||||
pintaFolha();
|
||||
novas.forEach(x=>{
|
||||
@@ -202,6 +215,7 @@ async function sel(fs){
|
||||
try{
|
||||
const an=analisarMapa(lido.mapa);
|
||||
x.an={...an, dpi:md.dpiFolha, fonteDpi:'arquivo', grande:false};
|
||||
aplicaCorte(x);
|
||||
}catch(e){
|
||||
if(md.tall){x.an=null;x.measurementError='Não foi possível conferir este PNG alto. Divida a folha em partes menores antes de pagar.';}
|
||||
}
|
||||
@@ -224,7 +238,7 @@ async function sel(fs){
|
||||
try{ x.an={...analisarMapa(await mapaDaImagem(fonte, md.larg, p=>{
|
||||
const pct=80+Math.floor(p*19);
|
||||
if(pct>mostrado){ mostrado=pct; x.pct=pct; pintaProgressoFolha(x); }
|
||||
})), fonteDpi:'arquivo'}; }catch(e){}
|
||||
})), fonteDpi:'arquivo'}; aplicaCorte(x); }catch(e){}
|
||||
if(fonte.close) fonte.close();
|
||||
}
|
||||
x.pct=null; pintaFolha(); marcaResiduos(x);
|
||||
|
||||
Reference in New Issue
Block a user