Registra spento sul frame gia' registrato, nuovo grab dopo il reset
Refs #123 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,7 @@ function visionExecute() {
|
||||
preview: false, // result on screen is an analysis only, not saved
|
||||
saved: false, // «Registra» done: the saved result replaces the preview
|
||||
lastBlob: null, // last frame shown, the one «Registra» saves
|
||||
recordedBlob: null, // #123: frame saved by the last successful «Registra»: not recordable twice
|
||||
paused: false, // operator paused the in-line loop
|
||||
registering: false, // «Registra» in progress: the loop stands still
|
||||
leaving: false, // page is being left: no more requests
|
||||
@@ -43,8 +44,10 @@ function visionExecute() {
|
||||
// #120: «Rimisura»/nuovo ciclo (task-result-reset): il pezzo va registrato di nuovo, anche senza camera
|
||||
window.addEventListener('task-result-reset', () => {
|
||||
this.saved = false;
|
||||
this.preview = !!this.result;
|
||||
this.kick();
|
||||
// #123: il frame gia' registrato non e' piu' un'anteprima ne' si registra due volte
|
||||
this.preview = !!this.result && this.lastBlob !== this.recordedBlob;
|
||||
// #123: camera impulsiva = frame nuovo subito (come all'apertura); in linea riparte il ciclo
|
||||
if (this.hasCamera && !this.inLinea) this.grab(); else this.kick();
|
||||
});
|
||||
if (!this.hasCamera) return;
|
||||
document.addEventListener('visibilitychange', () => { if (!document.hidden) this.kick(); });
|
||||
@@ -58,7 +61,7 @@ function visionExecute() {
|
||||
get hasCamera() { return !!(window.__visionCfg || {}).cameraAvailable; },
|
||||
get inLinea() { return this.hasCamera && (window.__visionCfg || {}).modo === 'in_linea'; },
|
||||
// «Registra» needs a frame on screen that is not saved yet
|
||||
get canRecord() { return !!this.lastBlob && !this.saved && !this.registering; },
|
||||
get canRecord() { return !!this.lastBlob && this.lastBlob !== this.recordedBlob && !this.saved && !this.registering; }, // #123: non sul frame gia' registrato
|
||||
|
||||
shouldRun() {
|
||||
return this.inLinea && !this.paused && !this.saved && !this.registering
|
||||
@@ -145,6 +148,7 @@ function visionExecute() {
|
||||
if (!this.error && this.result && this.result.vision_result_id) {
|
||||
this.preview = false;
|
||||
this.saved = true;
|
||||
this.recordedBlob = blob; // #123: questo frame e' registrato, Registra resta spento finche' non ne arriva uno nuovo
|
||||
this._emitRecorded(); // #120: la pagina conta le quote registrate
|
||||
}
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user