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.
@@ -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
- if (ripple.radius < ripple.maxRadius) {
192
- ripple.radius += ripple.maxRadius / 15;
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 (hasActiveRipples) {
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
 
@@ -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
- if (this.resizeTimeout) clearTimeout(this.resizeTimeout);
2388
+ if (this.resizeTimeout) clearTimeout(this.resizeTimeout);
2388
2389
 
2389
- this.resizeTimeout = setTimeout(() => {
2390
- this.width = window.innerWidth;
2391
- this.height = window.innerHeight;
2392
- this.setupCanvas();
2390
+ this.resizeTimeout = setTimeout(() => {
2391
+ const newWidth = window.innerWidth;
2392
+ const newHeight = window.innerHeight;
2393
2393
 
2394
- // Mettre à jour les dimensions dans le Worker
2395
- this.scrollWorker.postMessage({
2396
- type: 'UPDATE_DIMENSIONS',
2397
- payload: {
2398
- height: this.height
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
- for (const comp of this.components) {
2403
- if (comp._resize) {
2404
- comp._resize(this.width, this.height);
2405
- }
2406
- }
2407
- this.updateScrollWorkerComponents();
2408
- }, 150);
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
@@ -116,4 +116,4 @@ export { default as FeatureFlags } from './manager/FeatureFlags.js';
116
116
 
117
117
  // Version du framework
118
118
 
119
- export const VERSION = '0.5.13';
119
+ export const VERSION = '0.5.17';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvasframework",
3
- "version": "0.5.16",
3
+ "version": "0.5.17",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/beyons/CanvasFramework.git"