Update OCR settings to enhance number recognition accuracy by increasing maximum width. Adjust CSS styles for button dimensions and positioning, improving user interface consistency. Increment version code to 4.72.793 to reflect these changes.

This commit is contained in:
2026-07-13 14:01:32 -04:00
parent 93378a5a2d
commit d3b9fab7ce
3 changed files with 34 additions and 35 deletions

View File

@ -3422,23 +3422,22 @@ a.ms1-trad-link.btn-aide-trad{
overflow:hidden;
border-radius:6px;
background:#111;
/* Mode carre, borne pour rester visible au centre du telephone. */
/* Mode carre, comme le lecteur QR (taille d'avant le polish qui cassait la lecture). */
aspect-ratio:1 / 1;
width:min(100%, 360px, 72vw);
max-height:min(360px, 52vh);
width:100%;
max-width:360px;
margin:0 auto;
cursor:pointer;
outline:none;
scroll-margin:12px;
}
.inscr-gestion-bib-scan-capture.is-ready{
box-shadow:0 0 0 2px rgba(111,66,193,.35);
}
/* Ne pas bloquer les taps via CSS : le JS ignore deja si OCR pas pret. */
.inscr-gestion-bib-scan-capture[aria-disabled="true"]{
cursor:wait;
pointer-events:none;
}
.inscr-gestion-bib-scan-video,
@ -3473,20 +3472,17 @@ a.ms1-trad-link.btn-aide-trad{
.inscr-gestion-bib-scan-capture-label{
position:absolute;
left:50%;
bottom:6px;
bottom:8px;
transform:translateX(-50%);
max-width:88%;
padding:4px 10px;
border-radius:999px;
background:rgba(0,0,0,.72);
max-width:92%;
padding:5px 12px;
border-radius:10px;
background:rgba(0,0,0,.7);
color:#fff;
font-size:11px;
font-size:12px;
font-weight:600;
line-height:1.2;
line-height:1.3;
text-align:center;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
pointer-events:none;
}

View File

@ -431,7 +431,7 @@
(function () {
var BIB_MAX_LEN = 6;
var OCR_MAX_WIDTH = 320;
var OCR_MAX_WIDTH = 640;
var tesseractPromise = null;
var globalOcrWorker = null;
var globalOcrWorkerPromise = null;
@ -468,11 +468,10 @@
return Tesseract.createWorker('eng');
}).then(function (worker) {
globalOcrWorker = worker;
var params = {tessedit_char_whitelist: '0123456789'};
if (window.Tesseract && Tesseract.PSM && Tesseract.PSM.SINGLE_LINE) {
params.tessedit_pageseg_mode = Tesseract.PSM.SINGLE_LINE;
}
return worker.setParameters(params).then(function () {
// Chiffres seulement. Pas de SINGLE_LINE : trop fragile sur manuscrit espace.
return worker.setParameters({
tessedit_char_whitelist: '0123456789'
}).then(function () {
return globalOcrWorker;
});
}).catch(function (err) {
@ -488,8 +487,7 @@
});
}
// MSIN-4401 — Un numero de dossard = tous les chiffres lus dans le cadre
// (ex. OCR "5 2 1" ou "521" → "521"). Un chiffre seul = "5".
// Un numero = tous les chiffres lus dans le cadre (5+2+1 → 521).
function extractBibNumber(raw) {
var digits = String(raw || '').replace(/\D/g, '');
if (digits.length < 1 || digits.length > BIB_MAX_LEN) {
@ -498,7 +496,7 @@
return digits;
}
// Crop central du flux video — region du cadre blanc (~55% x 30%).
// Crop central du flux (region du cadre blanc).
function captureCenterFrame(videoEl) {
if (!videoEl || !videoEl.videoWidth) {
return null;
@ -599,7 +597,11 @@
return;
}
self.onCaptureClick = function () {
if (!self.workerReady || self.ocrBusy || activeScan !== self) {
if (self.ocrBusy || activeScan !== self) {
return;
}
if (!self.workerReady || !self.video) {
self.setStatus(scanMsg(self.panel, 'data-msg-loading', 'Initialisation (1re fois)...', 'Initializing (first time)...'), true);
return;
}
self.runOcr();
@ -696,6 +698,7 @@
}
var canvas = captureCenterFrame(self.video);
if (!canvas) {
self.setStatus(scanMsg(self.panel, 'data-msg-camera', 'Impossible d\'accéder à la caméra.', 'Unable to access the camera.'), false);
return;
}
self.ocrBusy = true;
@ -713,19 +716,25 @@
self.applyNumber(strNum);
return;
}
self.setStatus(scanMsg(self.panel, 'data-msg-invalid', 'Numéro illisible. Cadrez un seul numéro.', 'Unreadable number. Frame a single number.'), false);
// Montre ce que l'OCR a vu (chiffres) pour diagnostiquer sans outil.
var seen = String(rawText || '').replace(/\D/g, '');
var base = scanMsg(self.panel, 'data-msg-invalid', 'Numéro illisible. Cadrez un seul numéro.', 'Unreadable number. Frame a single number.');
if (seen) {
base += ' (' + seen + ')';
}
self.setStatus(base, false);
window.setTimeout(function () {
if (activeScan === self) {
self.showReady();
}
}, 1800);
}, 2200);
}).catch(function () {
self.setStatus(scanMsg(self.panel, 'data-msg-invalid', 'Numéro illisible. Cadrez un seul numéro.', 'Unreadable number. Frame a single number.'), false);
window.setTimeout(function () {
if (activeScan === self) {
self.showReady();
}
}, 1800);
}, 2200);
}).then(function () {
self.ocrBusy = false;
});
@ -746,12 +755,6 @@
self.toggleBtn.setAttribute('aria-expanded', 'true');
self.toggleBtn.classList.add('is-active');
}
// MSIN-4401 — Amener le viseur au centre du viewport (mobile).
try {
self.panel.scrollIntoView({behavior: 'smooth', block: 'center', inline: 'nearest'});
} catch (eScroll) {
self.panel.scrollIntoView(true);
}
self.setStatus(scanMsg(self.panel, 'data-msg-loading', 'Initialisation (1re fois)...', 'Initializing (first time)...'), true);
var cameraPromise = navigator.mediaDevices.getUserMedia({

View File

@ -7,7 +7,7 @@
* Constantes *
*
**************/
define('_VERSION_CODE', '4.72.792');
define('_VERSION_CODE', '4.72.793');
define('_DATE_CODE', '2026-07-13');
//MSIN-4290
define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe');