From 1f3f5f7c4f71ef8a707b29e87f91c0083dcf1c0b Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Sun, 25 Feb 2024 13:32:59 +0000 Subject: [PATCH] [fix] fit to content shown on groups (#2946) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- packages/tldraw/src/lib/ui/components/menu-items.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/tldraw/src/lib/ui/components/menu-items.tsx b/packages/tldraw/src/lib/ui/components/menu-items.tsx index 246ffd3a0..b40b29815 100644 --- a/packages/tldraw/src/lib/ui/components/menu-items.tsx +++ b/packages/tldraw/src/lib/ui/components/menu-items.tsx @@ -87,7 +87,10 @@ export function FitFrameToContentMenuItem() { () => { const onlySelectedShape = editor.getOnlySelectedShape() if (!onlySelectedShape) return false - return editor.getSortedChildIdsForParent(onlySelectedShape).length > 0 + return ( + editor.isShapeOfType(onlySelectedShape, 'frame') && + editor.getSortedChildIdsForParent(onlySelectedShape).length > 0 + ) }, [editor] )