@bebranded/bb-contents 1.0.72-beta → 1.0.74-beta
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/bb-contents.js +29 -17
- package/package.json +1 -1
package/bb-contents.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* BeBranded Contents
|
|
3
3
|
* Contenus additionnels français pour Webflow
|
|
4
|
-
* @version 1.0.
|
|
4
|
+
* @version 1.0.74-beta
|
|
5
5
|
* @author BeBranded
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @website https://www.bebranded.xyz
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
// Configuration
|
|
43
43
|
const config = {
|
|
44
|
-
version: '1.0.
|
|
44
|
+
version: '1.0.74-beta',
|
|
45
45
|
debug: true, // Debug activé pour diagnostic
|
|
46
46
|
prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
|
|
47
47
|
youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
|
|
@@ -391,8 +391,27 @@
|
|
|
391
391
|
|
|
392
392
|
console.log(`🔍 [MARQUEE] Safari Animation - direction: ${direction}, isVertical: ${isVertical}, contentSize: ${contentSize}`);
|
|
393
393
|
|
|
394
|
+
// Recalculer la taille si elle semble incorrecte (trop petite)
|
|
395
|
+
let finalContentSize = contentSize;
|
|
396
|
+
if (contentSize < 200) {
|
|
397
|
+
console.log(`⚠️ [MARQUEE] ContentSize trop petit (${contentSize}px), recalcul...`);
|
|
398
|
+
// Attendre un peu et recalculer
|
|
399
|
+
setTimeout(() => {
|
|
400
|
+
const newContentSize = isVertical ? mainBlock.offsetHeight : mainBlock.offsetWidth;
|
|
401
|
+
console.log(`🔍 [MARQUEE] Nouveau contentSize: ${newContentSize}px`);
|
|
402
|
+
if (newContentSize > contentSize) {
|
|
403
|
+
// Relancer l'animation avec la bonne taille
|
|
404
|
+
this.initSafariAnimation(element, scrollContainer, mainBlock, {
|
|
405
|
+
...options,
|
|
406
|
+
contentSize: newContentSize
|
|
407
|
+
});
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
}, 100);
|
|
411
|
+
}
|
|
412
|
+
|
|
394
413
|
// Solution Safari hybride : JavaScript avec optimisations Safari
|
|
395
|
-
const totalSize =
|
|
414
|
+
const totalSize = finalContentSize * 3 + gapSize * 2;
|
|
396
415
|
const step = (parseFloat(speed) * (isVertical ? 1.5 : 0.8)) / 60;
|
|
397
416
|
let isPaused = false;
|
|
398
417
|
|
|
@@ -406,7 +425,7 @@
|
|
|
406
425
|
// Position initiale optimisée pour Safari
|
|
407
426
|
let currentPosition;
|
|
408
427
|
if (direction === (isVertical ? 'bottom' : 'right')) {
|
|
409
|
-
currentPosition = -(
|
|
428
|
+
currentPosition = -(finalContentSize + gapSize);
|
|
410
429
|
} else {
|
|
411
430
|
currentPosition = 0;
|
|
412
431
|
}
|
|
@@ -419,32 +438,25 @@
|
|
|
419
438
|
|
|
420
439
|
console.log(`🔍 [MARQUEE] Safari - Position initiale: ${currentPosition}px, transform: ${initialTransform}`);
|
|
421
440
|
|
|
422
|
-
// Fonction d'animation Safari avec
|
|
423
|
-
let frameCount = 0;
|
|
441
|
+
// Fonction d'animation Safari avec arrondi pour éviter les sauts
|
|
424
442
|
const animate = () => {
|
|
425
443
|
if (!isPaused) {
|
|
426
|
-
frameCount++;
|
|
427
|
-
|
|
428
444
|
if (direction === (isVertical ? 'bottom' : 'right')) {
|
|
429
445
|
currentPosition += step;
|
|
430
446
|
// Reset standard pour direction bottom/right - 3 copies
|
|
431
447
|
if (currentPosition >= 0) {
|
|
432
|
-
|
|
433
|
-
currentPosition = -(contentSize + gapSize);
|
|
448
|
+
currentPosition = -(finalContentSize + gapSize);
|
|
434
449
|
}
|
|
435
450
|
} else {
|
|
436
451
|
currentPosition -= step;
|
|
437
452
|
// Reset standard pour direction top/left - 3 copies
|
|
438
|
-
if (currentPosition <= -(2 * (
|
|
439
|
-
|
|
440
|
-
currentPosition = -(contentSize + gapSize);
|
|
453
|
+
if (currentPosition <= -(2 * (finalContentSize + gapSize))) {
|
|
454
|
+
currentPosition = -(finalContentSize + gapSize);
|
|
441
455
|
}
|
|
442
456
|
}
|
|
443
457
|
|
|
444
|
-
//
|
|
445
|
-
|
|
446
|
-
console.log(`📍 [MARQUEE] Safari position: ${currentPosition}px (frame ${frameCount})`);
|
|
447
|
-
}
|
|
458
|
+
// ARRONDI pour éviter les erreurs de précision JavaScript
|
|
459
|
+
currentPosition = Math.round(currentPosition * 100) / 100;
|
|
448
460
|
|
|
449
461
|
// Transform optimisé pour Safari
|
|
450
462
|
const transform = isVertical
|