diff --git a/form_cliente.php b/form_cliente.php index b0a1c8c..4ce1194 100644 --- a/form_cliente.php +++ b/form_cliente.php @@ -1321,13 +1321,30 @@ const topaz = (() => { $('topaz-pts').textContent = '0'; _setStatus('Firme en el pad biométrico', false); + let _lastPts = -1; _poll = setInterval(() => { try { const pts = NumberOfTabletPoints(); $('topaz-pts').textContent = pts; const hasSig = pts > 0; $('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(); } }, 400); } diff --git a/ver_formulario_enviado.php b/ver_formulario_enviado.php index 12f0be2..f8e3312 100644 --- a/ver_formulario_enviado.php +++ b/ver_formulario_enviado.php @@ -2603,12 +2603,29 @@ const topaz = (() => { document.getElementById('topaz-pts').textContent = '0'; _setStatus('Firme en el pad biométrico', false); + let _lastPts = -1; _poll = setInterval(() => { try { const pts = NumberOfTabletPoints(); document.getElementById('topaz-pts').textContent = pts; 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(); } }, 400); }