Skip to content

Commit

Permalink
Merge pull request #441 from jorge-graca-sky/patch-2
Browse files Browse the repository at this point in the history
fix: order same zIndex elements by updateTreeOrder
  • Loading branch information
uguraslan authored Oct 10, 2023
2 parents 77bb97d + 59f804e commit 6963b82
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tree/core/ElementCore.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2031,6 +2031,9 @@ export default class ElementCore {
a.splice(ptr);
}
} else {
a.splice(n); // Remove items that were sorted in b array, so that we can sort a
+ // Beware that the function passed here to Array.sort must be stable
+ a.sort(ElementCore.sortZIndexedChildren); // Needed because items with same _zIndex may not be ordered by _updateTreeOrder
// Merge-sort arrays;
ptr = 0;
let i = 0;
Expand Down

0 comments on commit 6963b82

Please sign in to comment.