Scan-Feedback entfernt + dontInvert zurück
All checks were successful
Pin to IPFS / pin (push) Successful in 12s
All checks were successful
Pin to IPFS / pin (push) Successful in 12s
This commit is contained in:
parent
570606b6db
commit
f3f43ae68e
2 changed files with 2 additions and 22 deletions
14
app.js
14
app.js
|
|
@ -82,7 +82,6 @@
|
|||
/* ─── Camera ─── */
|
||||
let camStream = null;
|
||||
let camRaf = null;
|
||||
let camVideoEl = null;
|
||||
|
||||
async function camStart(videoId) {
|
||||
await camStop();
|
||||
|
|
@ -103,7 +102,6 @@
|
|||
}
|
||||
camStream = stream;
|
||||
const v = $(videoId);
|
||||
camVideoEl = v;
|
||||
v.srcObject = stream;
|
||||
v.setAttribute('playsinline', '');
|
||||
v.classList.add('active');
|
||||
|
|
@ -116,7 +114,6 @@
|
|||
}
|
||||
|
||||
function camStop() {
|
||||
if (camVideoEl) { camVideoEl.classList.remove('scan-active', 'scan-done'); camVideoEl = null; }
|
||||
if (camRaf) { cancelAnimationFrame(camRaf); camRaf = null; }
|
||||
if (camStream) { camStream.getTracks().forEach(t => t.stop()); camStream = null; }
|
||||
}
|
||||
|
|
@ -126,7 +123,6 @@
|
|||
const c = $(canvasId);
|
||||
const ctx = c.getContext('2d', { willReadFrequently: true });
|
||||
let lastScan = 0;
|
||||
v.classList.add('scan-active');
|
||||
|
||||
const detect = barcodeDetector
|
||||
? async () => {
|
||||
|
|
@ -137,7 +133,7 @@
|
|||
c.width = v.videoWidth; c.height = v.videoHeight;
|
||||
ctx.drawImage(v, 0, 0);
|
||||
const img = ctx.getImageData(0, 0, c.width, c.height);
|
||||
const code = jsQR(img.data, img.width, img.height, { inversionAttempts: 'attemptBoth' });
|
||||
const code = jsQR(img.data, img.width, img.height, { inversionAttempts: 'dontInvert' });
|
||||
return code ? code.data : null;
|
||||
};
|
||||
|
||||
|
|
@ -150,13 +146,7 @@
|
|||
if (raw) {
|
||||
const bytes = decode45(raw);
|
||||
const p = await unpack(bytes);
|
||||
if (p.v === 1) {
|
||||
v.classList.remove('scan-active');
|
||||
v.classList.add('scan-done');
|
||||
setTimeout(() => v.classList.remove('scan-done'), 600);
|
||||
callback(p, raw);
|
||||
return;
|
||||
}
|
||||
if (p.v === 1) { callback(p, raw); return; }
|
||||
}
|
||||
} catch (_) {}
|
||||
camRaf = requestAnimationFrame(tick);
|
||||
|
|
|
|||
10
style.css
10
style.css
|
|
@ -192,15 +192,6 @@ h3 {
|
|||
max-width: 320px;
|
||||
border-radius: var(--radius);
|
||||
border: 2px solid var(--border);
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
}
|
||||
video.scan-active {
|
||||
border-color: #ff4444 !important;
|
||||
box-shadow: 0 0 12px rgba(255,68,68,0.4);
|
||||
}
|
||||
video.scan-done {
|
||||
border-color: #44ff44 !important;
|
||||
box-shadow: 0 0 12px rgba(68,255,68,0.4);
|
||||
}
|
||||
|
||||
/* Protocol status */
|
||||
|
|
@ -350,7 +341,6 @@ video.scan-done {
|
|||
border-radius: var(--radius);
|
||||
display: none;
|
||||
margin: 8px auto;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
}
|
||||
#host-camera.active {
|
||||
display: block;
|
||||
|
|
|
|||
Loading…
Reference in a new issue