fix: smooth NP swipe-open animation; live playing highlight in song lists
Swipe animation: - _resetDrag(true) now reads the overlay's current drag position and starts the CSS transition from there instead of resetting to translateY(100%) first. That reset was causing the visible stutter (overlay jumped off-screen then slid back up). Now the overlay continues seamlessly from wherever the finger released to translateY(0). Playing highlight: - makeSongItem: adds data-song-id attribute to every .song-item element. - updatePlayerUI: calls _updatePlayingHighlights() after every track change. This toggles .playing on all visible song items in any open list/playlist/ favorites view so the highlighted row always matches what's actually playing, without requiring the user to navigate away and back. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
0fbb1385f1
commit
b0fb1b200d
3 files changed
+32
-2
No files matched your search
+23
-2
@@ -221,8 +221,29 @@ window.addEventListener('load', () => {
|
||||
function _resetDrag(open) {
|
||||
playerBar.classList.remove('dragging');
|
||||
playerBar.style.transform = '';
|
||||
if(npOverlay) { npOverlay.style.transition = ''; npOverlay.style.transform = ''; }
|
||||
if(open) openNowPlaying();
|
||||
|
||||
if (!npOverlay) { if(open) openNowPlaying(); _sy=0; _dragging=false; return; }
|
||||
|
||||
if (open) {
|
||||
// Continue animating from the current drag position instead of
|
||||
// resetting to translateY(100%) first (which caused the stutter).
|
||||
const m = npOverlay.style.transform.match(/translateY\(([^p]+)px\)/);
|
||||
const curY = m ? parseFloat(m[1]) : window.innerHeight;
|
||||
npOverlay.style.transition = 'none';
|
||||
npOverlay.style.transform = `translateY(${curY}px)`;
|
||||
void npOverlay.offsetHeight; // flush layout so curY is the transition start
|
||||
npOverlay.style.transition = '';
|
||||
npOverlay.style.transform = 'translateY(0)';
|
||||
npOverlay.addEventListener('transitionend', () => {
|
||||
npOverlay.style.transform = '';
|
||||
npOverlay.style.transition = '';
|
||||
}, { once: true });
|
||||
openNowPlaying();
|
||||
} else {
|
||||
npOverlay.style.transition = '';
|
||||
npOverlay.style.transform = '';
|
||||
}
|
||||
|
||||
_sy=0; _dragging=false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user