Browse Source

add additional comments, clean up drag code

master
jeffvli 3 years ago
parent
commit
fa64f1aef9
  1. 8
      src/redux/playQueueSlice.ts

8
src/redux/playQueueSlice.ts

@ -706,7 +706,8 @@ const playQueueSlice = createSlice({
return !uniqueIds.includes(entry.uniqueId); return !uniqueIds.includes(entry.uniqueId);
}); });
// Used if dragging onto a selected row /* Used if dragging onto the first selected row. We'll need to calculate the number of selected rows above the first selected row
so we can subtract it from the spliceIndexPre value when moving it into the newQueue, which has all selected entries removed */
const spliceIndexPre = getCurrentEntryIndexByUID( const spliceIndexPre = getCurrentEntryIndexByUID(
tempQueue, tempQueue,
action.payload.moveBeforeId action.payload.moveBeforeId
@ -717,15 +718,14 @@ const playQueueSlice = createSlice({
return uniqueIds.includes(entry.uniqueId); return uniqueIds.includes(entry.uniqueId);
}); });
console.log(`selectedAbovePre.length()`, selectedAbovePre.length);
// Used if dragging onto a non-selected row // Used if dragging onto a non-selected row
const spliceIndexPost = getCurrentEntryIndexByUID( const spliceIndexPost = getCurrentEntryIndexByUID(
newQueue, newQueue,
action.payload.moveBeforeId action.payload.moveBeforeId
); );
// If the moveBeforeId index is selected, then we find the first consecutive selected index to move to /* Used if dragging onto consecutive selected rows
If the moveBeforeId index is selected, then we find the first consecutive selected index to move to */
let firstConsecutiveSelectedDragIndex = -1; let firstConsecutiveSelectedDragIndex = -1;
for (let i = spliceIndexPre - 1; i > 0; i -= 1) { for (let i = spliceIndexPre - 1; i > 0; i -= 1) {
if (uniqueIds.includes(tempQueue[i].uniqueId)) { if (uniqueIds.includes(tempQueue[i].uniqueId)) {

Loading…
Cancel
Save