[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.
This commit is contained in:
Steve Ruiz 2024-02-25 13:32:59 +00:00 committed by GitHub
parent 2211ca0063
commit 1f3f5f7c4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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]
)