canvasframework 0.5.16 → 0.5.17
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/Button.js +13 -15
- package/core/CanvasFramework.js +31 -20
- package/index.js +1 -1
- package/package.json +1 -1
package/components/Button.js
CHANGED
|
@@ -185,27 +185,25 @@ class Button extends Component {
|
|
|
185
185
|
*/
|
|
186
186
|
animateRipple() {
|
|
187
187
|
const animate = () => {
|
|
188
|
-
let hasActiveRipples = false;
|
|
189
|
-
|
|
190
188
|
for (let ripple of this.ripples) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
hasActiveRipples = true;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (ripple.radius >= ripple.maxRadius * 0.5) {
|
|
197
|
-
ripple.opacity -= 0.05;
|
|
198
|
-
}
|
|
189
|
+
ripple.radius += ripple.maxRadius / 15;
|
|
190
|
+
ripple.opacity -= 0.05; // diminue progressivement
|
|
199
191
|
}
|
|
200
|
-
|
|
192
|
+
|
|
193
|
+
// Supprime les ripples complètement invisibles
|
|
201
194
|
this.ripples = this.ripples.filter(r => r.opacity > 0);
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (
|
|
195
|
+
|
|
196
|
+
// Redessine le bouton après mise à jour (important!)
|
|
197
|
+
if (this.framework && this.framework.redraw) {
|
|
198
|
+
this.framework.redraw();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Tant qu'il reste des ripples visibles, continue l'animation
|
|
202
|
+
if (this.ripples.length > 0) {
|
|
205
203
|
requestAnimationFrame(animate);
|
|
206
204
|
}
|
|
207
205
|
};
|
|
208
|
-
|
|
206
|
+
|
|
209
207
|
animate();
|
|
210
208
|
}
|
|
211
209
|
|
package/core/CanvasFramework.js
CHANGED
|
@@ -206,6 +206,7 @@ class CanvasFramework {
|
|
|
206
206
|
|
|
207
207
|
this.width = window.innerWidth;
|
|
208
208
|
this.height = window.innerHeight;
|
|
209
|
+
|
|
209
210
|
this.dpr = window.devicePixelRatio || 1;
|
|
210
211
|
|
|
211
212
|
// ✅ OPTIMISATION OPTION 2: Configuration des optimisations
|
|
@@ -2384,29 +2385,39 @@ class CanvasFramework {
|
|
|
2384
2385
|
}*/
|
|
2385
2386
|
|
|
2386
2387
|
handleResize() {
|
|
2387
|
-
|
|
2388
|
+
if (this.resizeTimeout) clearTimeout(this.resizeTimeout);
|
|
2388
2389
|
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
this.setupCanvas();
|
|
2390
|
+
this.resizeTimeout = setTimeout(() => {
|
|
2391
|
+
const newWidth = window.innerWidth;
|
|
2392
|
+
const newHeight = window.innerHeight;
|
|
2393
2393
|
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2394
|
+
// Règle clé : on resize UNIQUEMENT si la largeur a vraiment changé
|
|
2395
|
+
// (rotation, split-screen, vraie fenêtre changée)
|
|
2396
|
+
// À la fermeture du clavier → largeur = identique → on skip
|
|
2397
|
+
if (Math.abs(newWidth - this.width) <= 8) { // tolérance pixels (scrollbar, bordures...)
|
|
2398
|
+
console.log("[resize] Largeur identique → probablement clavier (open/close) → ignoré");
|
|
2399
|
+
return;
|
|
2400
|
+
}
|
|
2401
2401
|
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2402
|
+
console.log("[resize] Largeur changée → vrai resize");
|
|
2403
|
+
|
|
2404
|
+
this.width = newWidth;
|
|
2405
|
+
this.height = newHeight;
|
|
2406
|
+
|
|
2407
|
+
this.setupCanvas(); // ← change canvas.width/height + DPR + style
|
|
2408
|
+
this._maxScrollDirty = true;
|
|
2409
|
+
|
|
2410
|
+
if (this.scrollWorker) {
|
|
2411
|
+
this.scrollWorker.postMessage({
|
|
2412
|
+
type: 'UPDATE_DIMENSIONS',
|
|
2413
|
+
payload: { height: this.height }
|
|
2414
|
+
});
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
this.components.forEach(comp => comp.onResize?.(this.width, this.height));
|
|
2418
|
+
|
|
2419
|
+
}, 100); // 80–120 ms
|
|
2420
|
+
}
|
|
2410
2421
|
|
|
2411
2422
|
/*handleResize() {
|
|
2412
2423
|
if (this.resizeTimeout) clearTimeout(this.resizeTimeout); // ✅ AJOUTER
|
package/index.js
CHANGED