Skip to content

Commit

Permalink
Sort items-to-position by their order before positioning them
Browse files Browse the repository at this point in the history
  • Loading branch information
FranCarrascosaMS committed Jul 1, 2023
1 parent 7339770 commit 16fa0d3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/timeline/Stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,15 @@ function performStacking(items, margins, compareTimes, shouldStack, shouldOthers
}
}

// Sort items-to-position by their order
itemsToPosition.sort((a, b) => {
if (a.data.order !== b.data.order) {
return a.data.order - b.data.order;
}

return getItemStart(a) - getItemStart(b);
})

// Now we can loop through each item (in order) and find a position for them
previousStart = null;
let previousEnd = null;
Expand Down

0 comments on commit 16fa0d3

Please sign in to comment.