feat: add smooth slide-out animation for mobile panel closing

Added matching slide-out animation when closing the mobile panel to
match the smooth slide-in animation on opening:

CSS changes (style.css):
- Add .rpg-mobile-closing class with rpgSlideOutToRight animation
- Create @keyframes rpgSlideOutToRight (0.3s ease-in-out)
- Panel slides smoothly off-screen to right before hiding

JavaScript changes (index.js):
- Add closeMobilePanelWithAnimation() helper function
- Use animationend event to wait for animation before hiding
- Replace all instant removeClass() calls with helper function
- Maintains smooth 0.3s animation timing matching slide-in

Implementation details:
- Helper function adds .rpg-mobile-closing class
- Waits for CSS animation to complete via animationend event
- Then removes closing class and overlay
- All close operations now use this helper for consistency

Result: Panel now smoothly slides in AND out with matching 0.3s
animations. No more jarring instant disappearance on close.
This commit is contained in:
Lucas 'Paperboy' Rose-Winters
2025-10-16 12:33:07 +11:00
parent a6bc021148
commit 3d32a04d57
2 changed files with 46 additions and 24 deletions
+17
View File
@@ -3057,6 +3057,13 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
animation: rpgSlideInFromRight 0.3s ease-in-out;
}
/* Closing animation - slide out to right */
.rpg-panel.rpg-mobile-closing {
display: block !important;
z-index: 50;
animation: rpgSlideOutToRight 0.3s ease-in-out;
}
/* Slide-in animation from right */
@keyframes rpgSlideInFromRight {
from {
@@ -3067,6 +3074,16 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
}
}
/* Slide-out animation to right */
@keyframes rpgSlideOutToRight {
from {
transform: translateX(0);
}
to {
transform: translateX(100%);
}
}
/* Disable collapsed state on mobile */
.rpg-panel.rpg-collapsed {
max-width: 100dvw !important;