mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: multiplayer undo / redo (#7348)
This commit is contained in:
parent
5211b003b8
commit
530617be90
71 changed files with 34885 additions and 14877 deletions
|
@ -32,6 +32,7 @@ import {
|
|||
getSelectedElements,
|
||||
} from "../scene/selection";
|
||||
import { syncMovedIndices } from "../fractionalIndex";
|
||||
import { StoreAction } from "../store";
|
||||
|
||||
export const actionDuplicateSelection = register({
|
||||
name: "duplicateSelection",
|
||||
|
@ -54,13 +55,13 @@ export const actionDuplicateSelection = register({
|
|||
return {
|
||||
elements,
|
||||
appState: ret.appState,
|
||||
commitToHistory: true,
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
...duplicateElements(elements, appState),
|
||||
commitToHistory: true,
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
};
|
||||
},
|
||||
keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.key === KEYS.D,
|
||||
|
@ -241,9 +242,10 @@ const duplicateElements = (
|
|||
}
|
||||
|
||||
// step (3)
|
||||
const finalElements = finalElementsReversed.reverse();
|
||||
|
||||
syncMovedIndices(finalElements, arrayToMap([...oldElements, ...newElements]));
|
||||
const finalElements = syncMovedIndices(
|
||||
finalElementsReversed.reverse(),
|
||||
arrayToMap(newElements),
|
||||
);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue