|
2691 | 2691 | cursorFollower.style.top = followerY + 'px'; |
2692 | 2692 |
|
2693 | 2693 | // Track proximity separately from visual morph |
| 2694 | + var wasBadge = !!activeBadge; |
2694 | 2695 | activeBadge = closestEl || null; |
2695 | 2696 |
|
| 2697 | + // Re-apply hover when leaving badge but still over a link |
| 2698 | + if (wasBadge && !activeBadge && isOverInteractive) { |
| 2699 | + cursorFollower.classList.add('hovering'); |
| 2700 | + } |
| 2701 | + |
2696 | 2702 | // Shape: only apply transform/borderRadius when morphing |
2697 | 2703 | var isBlob = Math.abs(currentScaleX - 1) > 0.01 || Math.abs(currentScaleY - 1) > 0.01; |
2698 | 2704 |
|
|
2702 | 2708 | cursorFollower.style.transform = |
2703 | 2709 | 'translate(-50%, -50%) scale(' + currentScaleX.toFixed(3) + ',' + currentScaleY.toFixed(3) + ')'; |
2704 | 2710 | cursorFollower.style.borderRadius = currentBorderRadius.toFixed(1) + 'px'; |
2705 | | - } else if (isBlob && !closestRect && cursorFollower.classList.contains('hovering')) { |
2706 | | - // Left badge, now on a link: snap morph to default so CSS hover works |
| 2711 | + } else if (isBlob && cursorFollower.classList.contains('hovering')) { |
| 2712 | + // Left badge, on a link: snap morph to default so CSS hover works |
2707 | 2713 | currentScaleX = 1; |
2708 | 2714 | currentScaleY = 1; |
2709 | 2715 | currentBorderRadius = 6; |
|
2729 | 2735 | animateFollower(); |
2730 | 2736 |
|
2731 | 2737 | // Link hover — original behaviour (CSS width/height transition) |
| 2738 | + var isOverInteractive = false; |
2732 | 2739 | var interactiveElements = document.querySelectorAll('a, button, .theme-toggle'); |
2733 | 2740 | interactiveElements.forEach(function(el) { |
2734 | 2741 | el.addEventListener('mouseenter', function() { |
| 2742 | + isOverInteractive = true; |
2735 | 2743 | if (!activeBadge) cursorFollower.classList.add('hovering'); |
2736 | 2744 | }); |
2737 | 2745 | el.addEventListener('mouseleave', function() { |
| 2746 | + isOverInteractive = false; |
2738 | 2747 | cursorFollower.classList.remove('hovering'); |
2739 | 2748 | }); |
2740 | 2749 | }); |
|
0 commit comments