MCPcopy
hub / github.com/tldraw/tldraw / selectFirstChildShape

Method selectFirstChildShape

packages/editor/src/lib/editor/Editor.ts:2401–2411  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2399 }
2400
2401 selectFirstChildShape() {
2402 const selectedShapes = this.getSelectedShapes()
2403 if (!selectedShapes.length) return
2404 const selectedShape = selectedShapes[0]
2405 const children = this.getSortedChildIdsForParent(selectedShape.id)
2406 .map((id) => this.getShape(id))
2407 .filter((i) => i) as TLShape[]
2408 const sortedChildren = this._getShapesInReadingOrder(children)
2409 if (sortedChildren.length === 0) return
2410 this._selectShapesAndZoom([sortedChildren[0].id])
2411 }
2412
2413 private _selectShapesAndZoom(ids: TLShapeId[]) {
2414 this.setSelectedShapes(ids)

Callers 2

onKeyDownMethod · 0.80
navigation.test.tsFile · 0.80

Calls 6

getSelectedShapesMethod · 0.95
getShapeMethod · 0.95
_selectShapesAndZoomMethod · 0.95
filterMethod · 0.80

Tested by

no test coverage detected