Skip to content

Commit 8f9fa2f

Browse files
committed
Update version to 1.6.6 and enhance swipe indicator functionality: Changed the swipe indicator's opacity and animation duration for improved visibility. Updated interaction handling to remove the indicator after any user interaction, not just scrolling, ensuring a more intuitive experience for users.
1 parent cc8fd44 commit 8f9fa2f

2 files changed

Lines changed: 23 additions & 37 deletions

File tree

src/layouts/BaseLayout.astro

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,8 @@ try {
886886
font-size: 0.75rem;
887887
font-family: var(--font-sans);
888888
pointer-events: none;
889-
opacity: 0;
890-
animation: swipeHint 3s ease-in-out;
889+
opacity: 1;
890+
animation: swipeHint 2s ease-in-out infinite;
891891
white-space: nowrap;
892892
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
893893
z-index: 10;
@@ -899,36 +899,23 @@ try {
899899

900900
@keyframes swipeHint {
901901
0% {
902-
opacity: 0;
903-
transform: translateY(-50%) translateX(0);
904-
}
905-
10% {
906-
opacity: 1;
907902
transform: translateY(-50%) translateX(0);
908903
}
909904
25% {
910905
transform: translateY(-50%) translateX(-10px);
911906
}
912-
35% {
913-
transform: translateY(-50%) translateX(0);
914-
}
915907
50% {
916-
transform: translateY(-50%) translateX(-10px);
917-
}
918-
60% {
919908
transform: translateY(-50%) translateX(0);
920909
}
921-
80% {
922-
opacity: 1;
923-
transform: translateY(-50%) translateX(0);
910+
75% {
911+
transform: translateY(-50%) translateX(-10px);
924912
}
925913
100% {
926-
opacity: 0;
927914
transform: translateY(-50%) translateX(0);
928915
}
929916
}
930917

931-
/* Hide swipe indicator after user scrolls */
918+
/* Hide swipe indicator after user interacts */
932919
.katex-display.scrollable.scrolled::after {
933920
display: none;
934921
}
@@ -2202,33 +2189,32 @@ try {
22022189
});
22032190
});
22042191

2205-
// Add swipe indicator to scrollable math equations on mobile
2192+
// Add swipe indicator to scrollable math equations
22062193
function addMathSwipeIndicators() {
2207-
// Only on mobile devices
2208-
if (window.innerWidth > 768) return;
2209-
22102194
const equations = document.querySelectorAll('.katex-display');
22112195
equations.forEach((eq) => {
22122196
// Check if equation is scrollable (content wider than container)
22132197
if (eq.scrollWidth > eq.clientWidth + 5) {
22142198
eq.classList.add('scrollable');
22152199

2216-
// Remove indicator after user scrolls
2217-
let hasScrolled = false;
2218-
eq.addEventListener('scroll', () => {
2219-
if (!hasScrolled) {
2220-
hasScrolled = true;
2221-
eq.classList.add('scrolled');
2222-
}
2223-
}, { once: true });
2224-
2225-
// Also remove after touch (user is interacting)
2226-
eq.addEventListener('touchstart', () => {
2227-
if (!hasScrolled) {
2228-
hasScrolled = true;
2200+
// Remove indicator after user interacts
2201+
let hasInteracted = false;
2202+
2203+
const hideIndicator = () => {
2204+
if (!hasInteracted) {
2205+
hasInteracted = true;
22292206
eq.classList.add('scrolled');
22302207
}
2231-
}, { once: true });
2208+
};
2209+
2210+
// Hide on scroll
2211+
eq.addEventListener('scroll', hideIndicator, { once: true });
2212+
2213+
// Hide on touch
2214+
eq.addEventListener('touchstart', hideIndicator, { once: true });
2215+
2216+
// Hide on mouse down (for desktop)
2217+
eq.addEventListener('mousedown', hideIndicator, { once: true });
22322218
}
22332219
});
22342220
}

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.6.5",
2+
"version": "1.6.6",
33
"notes": "Update this file manually after significant changes. Follow semantic versioning: MAJOR.MINOR.PATCH"
44
}
55

0 commit comments

Comments
 (0)