mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: add element.updated
(#4070)
This commit is contained in:
parent
dac970c640
commit
f9d2d537a2
14 changed files with 500 additions and 4 deletions
|
@ -12,7 +12,7 @@ import {
|
|||
ExcalidrawFreeDrawElement,
|
||||
FontFamilyValues,
|
||||
} from "../element/types";
|
||||
import { measureText, getFontString } from "../utils";
|
||||
import { measureText, getFontString, getUpdatedTimestamp } from "../utils";
|
||||
import { randomInteger, randomId } from "../random";
|
||||
import { newElementWith } from "./mutateElement";
|
||||
import { getNewGroupIdsForDuplication } from "../groups";
|
||||
|
@ -22,7 +22,7 @@ import { adjustXYWithRotation } from "../math";
|
|||
import { getResizedElementAbsoluteCoords } from "./bounds";
|
||||
|
||||
type ElementConstructorOpts = MarkOptional<
|
||||
Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted">,
|
||||
Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">,
|
||||
| "width"
|
||||
| "height"
|
||||
| "angle"
|
||||
|
@ -75,6 +75,7 @@ const _newElementBase = <T extends ExcalidrawElement>(
|
|||
versionNonce: rest.versionNonce ?? 0,
|
||||
isDeleted: false as false,
|
||||
boundElementIds,
|
||||
updated: getUpdatedTimestamp(),
|
||||
});
|
||||
|
||||
export const newElement = (
|
||||
|
@ -337,6 +338,7 @@ export const duplicateElement = <TElement extends Mutable<ExcalidrawElement>>(
|
|||
} else {
|
||||
copy.id = randomId();
|
||||
}
|
||||
copy.updated = getUpdatedTimestamp();
|
||||
copy.seed = randomInteger();
|
||||
copy.groupIds = getNewGroupIdsForDuplication(
|
||||
copy.groupIds,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue