feat: stroke class, residue per artwork, mixed strokes, sheets split by class
All checks were successful
Build and deploy / Validate source (push) Successful in 1m25s
Build and deploy / Integration suite on a real stack (push) Successful in 4m40s
Build and deploy / Secret scan and release gate (push) Successful in 12s
Build and deploy / Publish images (push) Successful in 1m38s

Round 3, items 9, 4, 16 and 17 (Dropstar, 2026-10-30).

- 9: the Site measures the thinnest stroke of each sheet and loose artwork
  (alpha > 40, chamfer distance in strips, width at local maxima, 1st
  percentile, at 300 DPI) and sends stroke_px and C1/C2/C3 with the item.
  The Kanban shows the class prefilled in the approve step; Produção may
  change it (POST /orders/{id}/contraction, who and when recorded), and the
  manifest carries it.
- 4: the residue check runs on each loose artwork, accepted per artwork; the
  sheet inherits what was accepted.
- 16: fine lines and solid areas in one file. Loose art: a pop-up with
  [Subir separado] [Continuar assim]. Ready sheet: protect the fine lines
  (default), protect the solid areas (stroke_choice client_c3, starts at C3)
  or go back and send two sheets, which holds the order.
- 17: loose art of fine (C1, C2) and solid (C3) strokes goes on separate
  sheets, each its own order item (split group/part/of) with its own file
  and class. Each sheet rounds to 10 cm and the 1 m minimum is charged once
  per group, since the customer did not choose the split. Cart, payment
  summary, portal, receipt and mail show it as such.
- The board loads quote views in two queries instead of two per quote.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-03 10:24:29 -03:00
parent 388408d4d6
commit 2615163fd3
23 changed files with 547 additions and 57 deletions

View File

@@ -222,23 +222,53 @@ function medir(a){
if(!/\.png$/i.test(a.f.name)){ a.semPrevia=true; return a; }
a.lendo=0; a.leitura={inicio:Date.now(), p:0}; pintaArtes();
let mostrado=0;
const cv=await previaPngGrande(a.f, 1200, p=>{
const lido=await previaPngGrande(a.f, 1200, p=>{
const pct=Math.floor(p*100);
a.leitura.p=p;
if(pct-mostrado>=1){ mostrado=pct; a.lendo=pct; pintaProgressoArte(a); }
}).catch(()=>null);
}, a.px/300*2.54).catch(()=>null);
const cv=lido&&lido.cv;
if(lido&&lido.mapa) guardaMapaDaArte(a, lido.mapa);
a.lendo=null;
if(cv && artes.includes(a)){ a.src=cv.toDataURL('image/webp',0.9); a.miniSrc=miniatura(cv); a.fotoSrc=miniatura(cv,480,720); }
else if(!cv) a.decodeError=true;
return a;
}).catch(()=>{ a.decodeError=true; return a; });
}
return carregarImagem(a.f).then(img=>{
if(img){ a.prop=img.height/img.width; a.px=img.width; a.py=img.height; a.src=img.src; a.miniSrc=miniatura(img); a.fotoSrc=miniatura(img,480,720); }
return carregarImagem(a.f).then(async img=>{
if(img){ a.prop=img.height/img.width; a.px=img.width; a.py=img.height; a.src=img.src; a.miniSrc=miniatura(img); a.fotoSrc=miniatura(img,480,720);
// Read at its own pixels while the customer sets the width.
a.lendoArte=true;
mapaDaImagem(img, a.px/300*2.54).then(m=>guardaMapaDaArte(a,m)).catch(()=>{})
.finally(()=>{ a.lendoArte=false; if(artes.includes(a)) pintaArtes(); });
}
else a.decodeError=true;
return a;
});
}
// Item 4 (Dropstar, 30/10/2026): each loose artwork is checked like a sheet,
// at its own pixels: dots under 2 mm, and its thinnest stroke (item 9). Read
// once; the sizes in mm and the stroke at 300 DPI follow the width the
// customer asks for, so they are worked out again when it changes.
function guardaMapaDaArte(a,m){
a.mapa=m; a.anCm=null;
// The stroke in the art's own pixels: the map was read as if at 300 DPI.
a.tracoPx=analisarMapa(m).traco;
}
function analiseDaArte(a){
if(!a.mapa || !(a.cm>0)) return null;
if(a.anCm!==a.cm){
const m=a.mapa; m.larguraCm=a.cm; m.pxPorCm=m.wPx/a.cm;
a.an=analisarMapa(m); a.anCm=a.cm;
}
return a.an;
}
// The art's thinnest stroke at the width asked for, in pixels at 300 DPI.
function tracoDaArte(a){
if(!a.tracoPx || !(a.cm>0)) return null;
const px=Math.max(1,Math.round(a.tracoPx.px*300/dpiDe(a)));
return {px, classe:px<=4?'C1':px<=19?'C2':'C3', largos:a.tracoPx.largos};
}
// A metragem sai do arquivo, nunca do peso em bytes.
// imagem → proporção da imagem aplicada à largura do filme
// PDF → página única lida pelo PDF.js, com boxes, rotação e UserUnit