Rename shapes apis (#1787)
This PR updates APIs related to shapes in the Editor. - removes the requirement for an `id` when creating shapes - `shapesOnCurrentPage` -> `currentPageShapes` - `findAncestor` -> `findShapeAncestor` - `findCommonAncestor` -> `findCommonShapeAncestor` - Adds `getCurrentPageShapeIds` - `getAncestors` -> `getShapeAncestors` - `getClipPath` -> `getShapeClipPath` - `getGeometry` -> `getShapeGeometry` - `getHandles` -> `getShapeHandles` - `getTransform` -> `getShapeLocalTransform` - `getPageTransform` -> `getShapePageTransform` - `getOutlineSegments` -> `getShapeOutlineSegments` - `getPageBounds` -> `getShapePageBounds` - `getPageTransform` -> `getShapePageTransform` - `getParentTransform` -> `getShapeParentTransform` - `selectionBounds` -> `selectionRotatedPageBounds` ### Change Type - [x] `major` — Breaking change ### Test Plan - [x] Unit Tests
This commit is contained in:
parent
39dbbca90e
commit
bf27743595
104 changed files with 1151 additions and 1115 deletions
|
@ -33,7 +33,7 @@ export function createTLStore({ initialData, defaultName = '', ...rest }: TLStor
|
|||
'schema' in rest
|
||||
? rest.schema
|
||||
: createTLSchema({
|
||||
shapes: shapesOnCurrentPageToShapeMap(checkShapesAndAddCore(rest.shapeUtils)),
|
||||
shapes: currentPageShapesToShapeMap(checkShapesAndAddCore(rest.shapeUtils)),
|
||||
})
|
||||
return new Store({
|
||||
schema,
|
||||
|
@ -44,7 +44,7 @@ export function createTLStore({ initialData, defaultName = '', ...rest }: TLStor
|
|||
})
|
||||
}
|
||||
|
||||
function shapesOnCurrentPageToShapeMap(shapeUtils: TLShapeUtilConstructor<TLUnknownShape>[]) {
|
||||
function currentPageShapesToShapeMap(shapeUtils: TLShapeUtilConstructor<TLUnknownShape>[]) {
|
||||
return Object.fromEntries(
|
||||
shapeUtils.map((s): [string, SchemaShapeInfo] => [
|
||||
s.type,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue