MCPcopy
hub / github.com/tldraw/tldraw / getShapes

Function getShapes

packages/tldraw/src/test/paste.test.ts:89–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

87})
88
89function getShapes() {
90 const arr = editor.getCurrentPageShapes() as any[]
91
92 const results = { old: {}, new: {} } as {
93 old: Record<string, TLGeoShape | TLFrameShape>
94 new: Record<string, TLGeoShape | TLFrameShape>
95 }
96
97 Object.entries(ids).map(([normalId, shapeId]) => {
98 const shape = editor.getShape(shapeId as any) as any
99 const newShape = arr.find((s) => s.id !== shapeId && s.props.w === shape?.props.w)
100 results.old[normalId] = shape
101 results.new[normalId] = newShape
102 })
103
104 return results
105}
106
107it('Gets pasted shapes correctly', () => {
108 editor.select(ids.box1, ids.box2, ids.frame1, ids.box3)

Callers 1

paste.test.tsFile · 0.85

Calls 4

getCurrentPageShapesMethod · 0.80
getShapeMethod · 0.80
findMethod · 0.80
entriesMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…