mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fix group element removing (#1676)
This commit is contained in:
parent
17e9cc4506
commit
f413bab3de
11 changed files with 478 additions and 43 deletions
|
@ -34,7 +34,7 @@ export const mutateElement = <TElement extends Mutable<ExcalidrawElement>>(
|
|||
if (
|
||||
(element as any)[key] === value &&
|
||||
// if object, always update in case its deep prop was mutated
|
||||
(typeof value !== "object" || value === null)
|
||||
(typeof value !== "object" || value === null || key === "groupIds")
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import { measureText, getFontString } from "../utils";
|
|||
import { randomInteger, randomId } from "../random";
|
||||
import { newElementWith } from "./mutateElement";
|
||||
import { getNewGroupIdsForDuplication } from "../groups";
|
||||
import { AppState } from "../types";
|
||||
|
||||
type ElementConstructorOpts = {
|
||||
x: ExcalidrawGenericElement["x"];
|
||||
|
@ -169,7 +170,7 @@ export const deepCopyElement = (val: any, depth: number = 0) => {
|
|||
* @param overrides Any element properties to override
|
||||
*/
|
||||
export const duplicateElement = <TElement extends Mutable<ExcalidrawElement>>(
|
||||
editingGroupId: GroupId | null,
|
||||
editingGroupId: AppState["editingGroupId"],
|
||||
groupIdMapForOperation: Map<GroupId, GroupId>,
|
||||
element: TElement,
|
||||
overrides?: Partial<TElement>,
|
||||
|
|
|
@ -21,7 +21,7 @@ type _ExcalidrawElementBase = Readonly<{
|
|||
version: number;
|
||||
versionNonce: number;
|
||||
isDeleted: boolean;
|
||||
groupIds: GroupId[];
|
||||
groupIds: readonly GroupId[];
|
||||
}>;
|
||||
|
||||
export type ExcalidrawSelectionElement = _ExcalidrawElementBase & {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue