Skip to content
Extraits de code Groupes Projets
Valider 6c105410 rédigé par Deurstann's avatar Deurstann
Parcourir les fichiers

Fix queue shift

parent b834d7b4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!15Playlist system creation
......@@ -7,7 +7,7 @@ const { ipcRenderer } = require('electron'),
/* Global variables */
var countKaraInQueue = 0;
var currentSong = 0;
var currentSong = -1;
var currentSongElement;
var dragCounter = 0;
var leavedElement;
......@@ -208,7 +208,9 @@ window.onload = () => {
});
$('#queue-recenter').click(() => {
clearMenuQueue();
document.getElementsByClassName('karaQueue')[currentSong].scrollIntoView(true);
if(currentSongElement){
currentSongElement.scrollIntoView(true);
}
logger.debug('instance', 'Queue recenter');
});
$('#queue-find').click(() => {
......@@ -354,18 +356,14 @@ ipcRenderer.on('send-song-time-data', (event, timeData) => {
}px`;
if (timeData.state == 'play' || timeData.state == 'pause') {
if (currentSong != timeData.song) {
document.getElementsByClassName('karaQueue').some((element) => {
if(element.getElementsByClassName('position')[0].innerHTML == timeData.song+1){
element.style.background = '#6b7d8e';
if(prevElement) {
prevElement.style.background = '#4e5d6c';
}
element.scrollIntoView(true);
currentSongElement = element;
return true;
}
prevElement = element;
});
if(currentSongElement){
currentSongElement.style.background = '#4e5d6c'
}
pos = parseInt(timeData.song)+1;
currentSongElement = document.getElementById(`pos-${pos.toString()}`).parentElement;
currentSong = timeData.song;
currentSongElement.style.background = '#6b7d8e';
currentSongElement.scrollIntoView(true)
}
currentSongElement.style.background = '#6b7d8e';
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter