mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: sort bound text elements to fix text duplication z-index error (#5130)
* fix: sort bound text elements to fix text duplication z-index error * improve & sort groups & add tests * fix backtracking and discontiguous groups --------- Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
5a0334f37f
commit
a9c5bdb878
7 changed files with 761 additions and 118 deletions
|
@ -607,6 +607,14 @@ export const arrayToMap = <T extends { id: string } | string>(
|
|||
}, new Map());
|
||||
};
|
||||
|
||||
export const arrayToMapWithIndex = <T extends { id: string }>(
|
||||
elements: readonly T[],
|
||||
) =>
|
||||
elements.reduce((acc, element: T, idx) => {
|
||||
acc.set(element.id, [element, idx]);
|
||||
return acc;
|
||||
}, new Map<string, [element: T, index: number]>());
|
||||
|
||||
export const isTestEnv = () =>
|
||||
typeof process !== "undefined" && process.env?.NODE_ENV === "test";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue