canvasframework 0.5.53 → 0.5.54
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/Camera.js +22 -11
- package/components/FloatedCamera.js +9 -2
- package/core/CanvasFramework.js +4 -1
- package/package.json +1 -1
package/components/Camera.js
CHANGED
|
@@ -55,18 +55,29 @@ class Camera extends Component {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
async _mount() {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
super._mount?.();
|
|
59
|
+
|
|
60
|
+
// ✅ CORRECTION : Ne démarrer que si visible ET pas en navigation
|
|
61
|
+
if (this.visible &&
|
|
62
|
+
this.autoStart &&
|
|
63
|
+
!this.stream &&
|
|
64
|
+
!this.isStarting &&
|
|
65
|
+
!this.framework._isNavigating) {
|
|
66
|
+
this.isStarting = true;
|
|
67
|
+
await this.startCamera();
|
|
68
|
+
this.isStarting = false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.setupEventListeners();
|
|
68
72
|
}
|
|
69
|
-
|
|
73
|
+
|
|
74
|
+
onUnmount() {
|
|
75
|
+
this.removeEventListeners();
|
|
76
|
+
this.stopCamera();
|
|
77
|
+
if (this.flashTimer) clearTimeout(this.flashTimer);
|
|
78
|
+
if (this.previewTimeout) clearTimeout(this.previewTimeout);
|
|
79
|
+
}
|
|
80
|
+
|
|
70
81
|
destroy() {
|
|
71
82
|
this.removeEventListeners();
|
|
72
83
|
this.stopCamera();
|
|
@@ -57,8 +57,8 @@ class FloatedCamera extends Component {
|
|
|
57
57
|
async _mount() {
|
|
58
58
|
super._mount?.();
|
|
59
59
|
|
|
60
|
-
//
|
|
61
|
-
if (this.autoStart && !this.stream && !this.isStarting) {
|
|
60
|
+
// ✅ CORRECTION : Ne démarrer que si visible ET pas en navigation
|
|
61
|
+
if (this.visible && this.autoStart && !this.stream && !this.isStarting && !this.framework._isNavigating) {
|
|
62
62
|
this.isStarting = true;
|
|
63
63
|
await this.startCamera();
|
|
64
64
|
this.isStarting = false;
|
|
@@ -66,6 +66,13 @@ class FloatedCamera extends Component {
|
|
|
66
66
|
|
|
67
67
|
this.setupEventListeners();
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
onUnmount() {
|
|
71
|
+
this.removeEventListeners();
|
|
72
|
+
this.stopCamera();
|
|
73
|
+
if (this.flashTimer) clearTimeout(this.flashTimer);
|
|
74
|
+
if (this.previewTimeout) clearTimeout(this.previewTimeout);
|
|
75
|
+
}
|
|
69
76
|
|
|
70
77
|
destroy() {
|
|
71
78
|
this.removeEventListeners();
|
package/core/CanvasFramework.js
CHANGED
|
@@ -2004,7 +2004,6 @@ class CanvasFramework {
|
|
|
2004
2004
|
// Destroy le composant pour être sûr
|
|
2005
2005
|
if (comp.destroy && typeof comp.destroy === 'function') {
|
|
2006
2006
|
comp.destroy();
|
|
2007
|
-
comp._unmount();
|
|
2008
2007
|
}
|
|
2009
2008
|
}
|
|
2010
2009
|
|
|
@@ -2041,9 +2040,13 @@ class CanvasFramework {
|
|
|
2041
2040
|
|
|
2042
2041
|
// ===== CRÉER LES NOUVEAUX COMPOSANTS =====
|
|
2043
2042
|
this.components = [];
|
|
2043
|
+
this._isNavigating = true; // ✅ Flag pour empêcher l'auto-démarrages
|
|
2044
|
+
|
|
2044
2045
|
if (typeof route.component === 'function') {
|
|
2045
2046
|
route.component(this, params, query);
|
|
2046
2047
|
}
|
|
2048
|
+
|
|
2049
|
+
this._isNavigating = false; // ✅ Navigation terminée
|
|
2047
2050
|
|
|
2048
2051
|
// ===== LANCER L'ANIMATION DE TRANSITION =====
|
|
2049
2052
|
if (animate && !this.transitionState.isTransitioning) {
|