mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
reconciliate order based on fractional index
This commit is contained in:
parent
1e132e33ae
commit
a7154227cf
4 changed files with 35 additions and 131 deletions
|
@ -18,7 +18,7 @@ import throttle from "lodash.throttle";
|
|||
import { newElementWith } from "../../src/element/mutateElement";
|
||||
import { BroadcastedExcalidrawElement } from "./reconciliation";
|
||||
import { encryptData } from "../../src/data/encryption";
|
||||
import { PRECEDING_ELEMENT_KEY } from "../../src/constants";
|
||||
import { normalizeFractionalIndexing } from "../../src/zindex";
|
||||
|
||||
class Portal {
|
||||
collab: TCollabClass;
|
||||
|
@ -150,11 +150,7 @@ class Portal {
|
|||
this.broadcastedElementVersions.get(element.id)!) &&
|
||||
isSyncableElement(element)
|
||||
) {
|
||||
acc.push({
|
||||
...element,
|
||||
// z-index info for the reconciler
|
||||
[PRECEDING_ELEMENT_KEY]: idx === 0 ? "^" : elements[idx - 1]?.id,
|
||||
});
|
||||
acc.push(element);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
|
@ -164,7 +160,7 @@ class Portal {
|
|||
const data: SocketUpdateDataSource[typeof updateType] = {
|
||||
type: updateType,
|
||||
payload: {
|
||||
elements: syncableElements,
|
||||
elements: normalizeFractionalIndexing(syncableElements),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue