fix: preview en tiempo real de firma Topaz en modal
Usar GetSigImageB64 en el poll para actualizar el canvas del overlay cada vez que cambia el número de puntos. SigImage/0 (SigWebRefresh) solo devuelve el trazo actual; SigImage/1 acumula toda la firma. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
719f27d863
commit
136b123cc0
+18
-1
@@ -1321,13 +1321,30 @@ const topaz = (() => {
|
|||||||
$('topaz-pts').textContent = '0';
|
$('topaz-pts').textContent = '0';
|
||||||
_setStatus('Firme en el pad biométrico', false);
|
_setStatus('Firme en el pad biométrico', false);
|
||||||
|
|
||||||
|
let _lastPts = -1;
|
||||||
_poll = setInterval(() => {
|
_poll = setInterval(() => {
|
||||||
try {
|
try {
|
||||||
const pts = NumberOfTabletPoints();
|
const pts = NumberOfTabletPoints();
|
||||||
$('topaz-pts').textContent = pts;
|
$('topaz-pts').textContent = pts;
|
||||||
const hasSig = pts > 0;
|
const hasSig = pts > 0;
|
||||||
$('topaz-btn-aceptar').disabled = !hasSig;
|
$('topaz-btn-aceptar').disabled = !hasSig;
|
||||||
if (hasSig) _setStatus('✅ Firma detectada — presione Aceptar', true);
|
if (hasSig) {
|
||||||
|
_setStatus('✅ Firma detectada — presione Aceptar', true);
|
||||||
|
if (pts !== _lastPts) {
|
||||||
|
_lastPts = pts;
|
||||||
|
GetSigImageB64(function(b64) {
|
||||||
|
if (!b64) return;
|
||||||
|
const img = new Image();
|
||||||
|
img.onload = () => {
|
||||||
|
const cv = document.getElementById('topaz-canvas');
|
||||||
|
const cx = cv.getContext('2d');
|
||||||
|
cx.clearRect(0, 0, cv.width, cv.height);
|
||||||
|
cx.drawImage(img, 0, 0, cv.width, cv.height);
|
||||||
|
};
|
||||||
|
img.src = 'data:image/png;base64,' + b64;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch(e) { _stopPoll(); }
|
} catch(e) { _stopPoll(); }
|
||||||
}, 400);
|
}, 400);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2603,12 +2603,29 @@ const topaz = (() => {
|
|||||||
document.getElementById('topaz-pts').textContent = '0';
|
document.getElementById('topaz-pts').textContent = '0';
|
||||||
_setStatus('Firme en el pad biométrico', false);
|
_setStatus('Firme en el pad biométrico', false);
|
||||||
|
|
||||||
|
let _lastPts = -1;
|
||||||
_poll = setInterval(() => {
|
_poll = setInterval(() => {
|
||||||
try {
|
try {
|
||||||
const pts = NumberOfTabletPoints();
|
const pts = NumberOfTabletPoints();
|
||||||
document.getElementById('topaz-pts').textContent = pts;
|
document.getElementById('topaz-pts').textContent = pts;
|
||||||
document.getElementById('topaz-btn-aceptar').disabled = pts === 0;
|
document.getElementById('topaz-btn-aceptar').disabled = pts === 0;
|
||||||
if (pts > 0) _setStatus('✅ Firma detectada — presione Aceptar', true);
|
if (pts > 0) {
|
||||||
|
_setStatus('✅ Firma detectada — presione Aceptar', true);
|
||||||
|
if (pts !== _lastPts) {
|
||||||
|
_lastPts = pts;
|
||||||
|
GetSigImageB64(function(b64) {
|
||||||
|
if (!b64) return;
|
||||||
|
const img = new Image();
|
||||||
|
img.onload = () => {
|
||||||
|
const cv = document.getElementById('topaz-canvas');
|
||||||
|
const cx = cv.getContext('2d');
|
||||||
|
cx.clearRect(0, 0, cv.width, cv.height);
|
||||||
|
cx.drawImage(img, 0, 0, cv.width, cv.height);
|
||||||
|
};
|
||||||
|
img.src = 'data:image/png;base64,' + b64;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch(e) { _stopPoll(); }
|
} catch(e) { _stopPoll(); }
|
||||||
}, 400);
|
}, 400);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user