* Determine whether or not any of a shape's ancestors are selected. * * @param shape - The shape (or shape id) of the shape to check. * * @public
(shape: TLShape | TLShapeId)
| 2088 | * @public |
| 2089 | */ |
| 2090 | isAncestorSelected(shape: TLShape | TLShapeId): boolean { |
| 2091 | const id = typeof shape === 'string' ? shape : (shape?.id ?? null) |
| 2092 | const _shape = this.getShape(id) |
| 2093 | if (!_shape) return false |
| 2094 | const selectedShapeIds = this.getSelectedShapeIds() |
| 2095 | return !!this.findShapeAncestor(_shape, (parent) => selectedShapeIds.includes(parent.id)) |
| 2096 | } |
| 2097 | |
| 2098 | /** |
| 2099 | * Select one or more shapes. |
no test coverage detected