[fix] fit to content shown on groups (#2946)

This PR fixes a bug where "fit to content" would be shown on groups.

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Fix bug where "fit frame to content" would be shown when a group is
selected.
point-docs-to-dev-example^2
Steve Ruiz 2024-02-25 13:32:59 +00:00 zatwierdzone przez GitHub
rodzic 2211ca0063
commit 1f3f5f7c4f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -87,7 +87,10 @@ export function FitFrameToContentMenuItem() {
() => {
const onlySelectedShape = editor.getOnlySelectedShape()
if (!onlySelectedShape) return false
return editor.getSortedChildIdsForParent(onlySelectedShape).length > 0
return (
editor.isShapeOfType<TLFrameShape>(onlySelectedShape, 'frame') &&
editor.getSortedChildIdsForParent(onlySelectedShape).length > 0
)
},
[editor]
)