From 7dd045bb33163f4b527de4de4b3f6afa6b7985b0 Mon Sep 17 00:00:00 2001
From: Jeff Emmett <46964190+Jeff-Emmett@users.noreply.github.com>
Date: Wed, 27 Nov 2024 13:16:52 +0700
Subject: [PATCH] fix menus
---
src/ui-overrides.tsx | 70 ++++++++++++--------------------------------
1 file changed, 19 insertions(+), 51 deletions(-)
diff --git a/src/ui-overrides.tsx b/src/ui-overrides.tsx
index 91b02f5..cd918e6 100644
--- a/src/ui-overrides.tsx
+++ b/src/ui-overrides.tsx
@@ -226,56 +226,6 @@ const revertCamera = (editor: Editor) => {
}
};
-function CustomContextMenu(props: TLUiContextMenuProps) {
- const editor = useEditor()
- const hasSelection = editor.getSelectedShapeIds().length > 0
- const selectedShape = editor.getSelectedShapes()[0]
- const hasCameraHistory = cameraHistory.length > 0
-
- return (
-
-
- {
- console.log('Reverting camera');
- revertCamera(editor);
- }}
- />
- {
- console.log('Zoom to Selection clicked');
- zoomToSelection(editor);
- }}
- />
- {
- console.log('Copy Link to Current View clicked');
- copyLinkToCurrentView(editor);
- }}
- />
-
-
-
- )
-}
-
export const uiOverrides: TLUiOverrides = {
tools(editor, tools) {
return {
@@ -409,6 +359,8 @@ export const components: TLComponents = {
const editor = useEditor()
const hasSelection = editor.getSelectedShapeIds().length > 0
const hasCameraHistory = cameraHistory.length > 0
+ const selectedShape = editor.getSelectedShapes()[0]
+ const isFrame = selectedShape?.type === 'frame'
return (
@@ -426,7 +378,7 @@ export const components: TLComponents = {
id="copy-link-to-current-view"
label="Copy Link to Current View"
icon="link"
- kbd="c"
+ kbd="s"
onSelect={() => copyLinkToCurrentView(editor)}
/>
revertCamera(editor)}
/>
+ {isFrame && (
+ <>
+ copyFrameLink(editor, selectedShape.id)}
+ />
+ zoomToSelection(editor)}
+ />
+ >
+ )}
)