mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Normalize indices on init
This commit is contained in:
parent
7b36de0476
commit
e4c3744dc4
8 changed files with 112 additions and 31 deletions
|
@ -18,6 +18,7 @@ import {
|
|||
restoreElements,
|
||||
zoomToFitBounds,
|
||||
reconcileElements,
|
||||
normalizeIndices,
|
||||
} from "../../packages/excalidraw";
|
||||
import type { Collaborator, Gesture } from "../../packages/excalidraw/types";
|
||||
import {
|
||||
|
@ -637,7 +638,16 @@ class Collab extends PureComponent<CollabProps, CollabState> {
|
|||
fetchScene: true,
|
||||
roomLinkData: existingRoomLinkData,
|
||||
});
|
||||
scenePromise.resolve(sceneData);
|
||||
|
||||
if (sceneData) {
|
||||
scenePromise.resolve({
|
||||
...sceneData,
|
||||
// normalize fractional indices on init for shared scenes, while making sure there are no other collaborators
|
||||
elements: normalizeIndices([...sceneData.elements]),
|
||||
});
|
||||
} else {
|
||||
scenePromise.resolve(null);
|
||||
}
|
||||
});
|
||||
|
||||
this.portal.socket.on(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue