* Get a shape by its id. * * @example * ```ts * editor.getShape('box1') * ``` * * @param shape - The shape (or the id of the shape) to get. * * @public
(shape: TLShape | TLParentId)
| 6247 | * @public |
| 6248 | */ |
| 6249 | getShape<T extends TLShape = TLShape>(shape: TLShape | TLParentId): T | undefined { |
| 6250 | const id = typeof shape === 'string' ? shape : shape.id |
| 6251 | if (!isShapeId(id)) return undefined |
| 6252 | return this.store.get(id) as T |
| 6253 | } |
| 6254 | |
| 6255 | /** |
| 6256 | * Get the parent shape for a given shape. Returns undefined if the shape is the direct child of |