Introduce selection for elements in z stack aka target mode

Summary:
The old layout plugins target mode would ask you which view you wanted to select when you clicked, the visualiser currently chooses for you based on size of the element.

Sometimes this isnt what you want so I have added a context menu with all the intersecting nodes from which you can select or focus

Reviewed By: lblasa

Differential Revision: D47589789

fbshipit-source-id: 9c9d0d7587b830aa72089267d9bcf2b687142574
This commit is contained in:
Luke De Feo
2023-07-26 03:22:38 -07:00
committed by Facebook GitHub Bot
parent dca958cc9e
commit 3891a5d61b
2 changed files with 83 additions and 14 deletions

View File

@@ -22,7 +22,9 @@ export const UIDebuggerMenuItem: React.FC<{
text: string;
icon?: React.ReactNode;
onClick?: () => void;
}> = ({text, onClick, icon}) => {
onMouseEnter?: () => void;
onMouseLeave?: () => void;
}> = ({text, onClick, icon, onMouseEnter, onMouseLeave}) => {
const instance = usePlugin(plugin);
const isMenuOpen = useValue(instance.uiState.isContextMenuOpen);
@@ -36,6 +38,8 @@ export const UIDebuggerMenuItem: React.FC<{
}
return (
<Menu.Item
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
disabled={onClick == null}
onClick={() => {
onClick?.();