[feature] add meta
property to records (#1627)
This PR adds a `meta` property to shapes and other records. It adds it to: - asset - camera - document - instance - instancePageState - instancePresence - page - pointer - rootShape ## Setting meta This data can generally be added wherever you would normally update the corresponding record. An exception exists for shapes, which can be updated using a partial of the `meta` in the same way that we update shapes with a partial of `props`. ```ts this.updateShapes([{ id: myShape.id, type: "geo", meta: { nemesis: "steve", special: true } ]) ``` ## `Editor.getInitialMetaForShape` The `Editor.getInitialMetaForShape` method is kind of a hack to set the initial meta property for newly created shapes. You can set it externally. Escape hatch! ### Change Type - [x] `minor` — New feature ### Test Plan todo - [ ] Unit Tests (todo) ### Release Notes - todo
This commit is contained in:
parent
3e07f70440
commit
fd29006538
39 changed files with 594 additions and 95 deletions
|
@ -11,7 +11,7 @@ import { OptionalErrorBoundary } from './ErrorBoundary'
|
|||
class ShapeWithPropsEquality {
|
||||
constructor(public shape: TLShape | undefined) {}
|
||||
equals(other: ShapeWithPropsEquality) {
|
||||
return this.shape?.props === other?.shape?.props
|
||||
return this.shape?.props === other?.shape?.props || this.shape?.meta === other?.shape?.meta
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue