canvasframework 0.5.12 → 0.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/QRCodeReader.js +9 -6
- package/core/CanvasFramework.js +24 -3
- package/index.js +1 -1
- package/package.json +1 -1
|
@@ -354,15 +354,18 @@ class QRCodeReader extends Component {
|
|
|
354
354
|
|
|
355
355
|
// Fond semi-transparent autour
|
|
356
356
|
ctx.fillStyle = 'rgba(0, 0, 0, 0.7)';
|
|
357
|
-
|
|
357
|
+
|
|
358
358
|
// Haut
|
|
359
|
-
ctx.fillRect(this.x, this.y, this.width, centerY - halfSize);
|
|
359
|
+
ctx.fillRect(this.x, this.y, this.width, centerY - this.y - halfSize);
|
|
360
|
+
|
|
360
361
|
// Bas
|
|
361
|
-
ctx.fillRect(this.x, centerY + halfSize, this.width, this.height - (centerY + halfSize));
|
|
362
|
+
ctx.fillRect(this.x, centerY + halfSize, this.width, this.y + this.height - (centerY + halfSize));
|
|
363
|
+
|
|
362
364
|
// Gauche
|
|
363
|
-
ctx.fillRect(this.x, centerY - halfSize, centerX - halfSize, frameSize);
|
|
365
|
+
ctx.fillRect(this.x, centerY - halfSize, centerX - this.x - halfSize, frameSize);
|
|
366
|
+
|
|
364
367
|
// Droite
|
|
365
|
-
ctx.fillRect(centerX + halfSize, centerY - halfSize,
|
|
368
|
+
ctx.fillRect(centerX + halfSize, centerY - halfSize, this.x + this.width - (centerX + halfSize), frameSize);
|
|
366
369
|
|
|
367
370
|
// Cadre de scan
|
|
368
371
|
ctx.strokeStyle = this.scannerFrameColor;
|
|
@@ -371,7 +374,7 @@ class QRCodeReader extends Component {
|
|
|
371
374
|
|
|
372
375
|
// Coins décoratifs
|
|
373
376
|
const cornerSize = 20;
|
|
374
|
-
|
|
377
|
+
|
|
375
378
|
// Coin haut gauche
|
|
376
379
|
ctx.beginPath();
|
|
377
380
|
ctx.moveTo(centerX - halfSize, centerY - halfSize + cornerSize);
|
package/core/CanvasFramework.js
CHANGED
|
@@ -1932,16 +1932,37 @@ class CanvasFramework {
|
|
|
1932
1932
|
// ✅ OPTIONNEL : Marquer les composants comme "dirty" pour forcer le rendu
|
|
1933
1933
|
this._maxScrollDirty = true;
|
|
1934
1934
|
|
|
1935
|
-
|
|
1935
|
+
// ✅ ARRÊTER LES CAMÉRAS DES ANCIENS COMPOSANTS
|
|
1936
|
+
oldComponents.forEach(comp => {
|
|
1936
1937
|
// Vérifier si c'est un composant caméra
|
|
1937
|
-
if (comp.constructor.name === 'FloatedCamera' ||
|
|
1938
|
+
if (comp.constructor.name === 'FloatedCamera' ||
|
|
1939
|
+
comp.constructor.name === 'Camera' ||
|
|
1940
|
+
comp.constructor.name === 'QRCodeReader') {
|
|
1938
1941
|
// Arrêter le stream vidéo
|
|
1939
1942
|
if (comp.stopCamera && typeof comp.stopCamera === 'function') {
|
|
1940
1943
|
comp.stopCamera();
|
|
1941
|
-
console.log(`🎥 Caméra ${comp.constructor.name} arrêtée avant navigation`);
|
|
1942
1944
|
}
|
|
1943
1945
|
}
|
|
1944
1946
|
});
|
|
1947
|
+
|
|
1948
|
+
// ✅ NOUVEAU : Vérifier si la nouvelle route contient des composants caméra
|
|
1949
|
+
const hasCamera = this.components.some(comp =>
|
|
1950
|
+
comp.constructor.name === 'FloatedCamera' ||
|
|
1951
|
+
comp.constructor.name === 'Camera' ||
|
|
1952
|
+
comp.constructor.name === 'QRCodeReader'
|
|
1953
|
+
);
|
|
1954
|
+
|
|
1955
|
+
// Si la nouvelle route N'A PAS de caméra, nettoyer toutes les vidéos après 3 secondes
|
|
1956
|
+
if (!hasCamera) {
|
|
1957
|
+
console.log('⏰ Nettoyage des vidéos programmé dans 3 secondes...');
|
|
1958
|
+
setTimeout(() => {
|
|
1959
|
+
const videos = document.querySelectorAll('video');
|
|
1960
|
+
videos.forEach(v => v.remove());
|
|
1961
|
+
}, 3000);
|
|
1962
|
+
} else {
|
|
1963
|
+
console.log('📹 Route avec caméra détectée, pas de nettoyage automatique');
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1945
1966
|
}
|
|
1946
1967
|
|
|
1947
1968
|
/**
|
package/index.js
CHANGED