MCPcopy
hub / github.com/tldraw/tldraw / createRect

Function createRect

packages/tldraw/src/test/frames.test.ts:1366–1378  ·  view source on GitHub ↗
({ pos, size }: { pos: [number, number]; size: [number, number] })

Source from the content-addressed store, hash-verified

1364}
1365
1366function createRect({ pos, size }: { pos: [number, number]; size: [number, number] }) {
1367 const rectId: TLShapeId = createShapeId()
1368 editor.createShapes([
1369 {
1370 id: rectId,
1371 x: pos[0],
1372 y: pos[1],
1373 props: { w: size[0], h: size[1] },
1374 type: 'geo',
1375 },
1376 ])
1377 return rectId
1378}
1379
1380describe('Unparenting behavior', () => {
1381 it("unparents a shape when it's completely dragged out of a frame, even when the pointer doesn't move across the edge of the frame", () => {

Callers 1

frames.test.tsFile · 0.85

Calls 2

createShapeIdFunction · 0.85
createShapesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…