feat(ui): hold shift to make nodes draggable from anywhere

This commit is contained in:
psychedelicious 2023-07-15 00:45:26 +10:00
parent 0257b4a611
commit 30e45eaf47
3 changed files with 7 additions and 3 deletions

View File

@ -53,14 +53,14 @@ export const InvocationComponent = memo((props: NodeProps<InvocationValue>) => {
description={template.description} description={template.description}
/> />
<Flex <Flex
className="nopan" className={'nopan'}
sx={{ sx={{
cursor: 'auto',
flexDirection: 'column', flexDirection: 'column',
borderBottomRadius: 'md', borderBottomRadius: 'md',
py: 2, py: 2,
bg: 'base.200', bg: 'base.200',
_dark: { bg: 'base.800' }, _dark: { bg: 'base.800' },
cursor: 'auto',
}} }}
> >
<IAINodeOutputs nodeId={nodeId} outputs={outputs} template={template} /> <IAINodeOutputs nodeId={nodeId} outputs={outputs} template={template} />

View File

@ -2,6 +2,8 @@ import { Box, useToken } from '@chakra-ui/react';
import { NODE_MIN_WIDTH } from 'app/constants'; import { NODE_MIN_WIDTH } from 'app/constants';
import { PropsWithChildren } from 'react'; import { PropsWithChildren } from 'react';
import { DRAG_HANDLE_CLASSNAME } from '../hooks/useBuildInvocation';
import { useAppSelector } from 'app/store/storeHooks';
type NodeWrapperProps = PropsWithChildren & { type NodeWrapperProps = PropsWithChildren & {
selected: boolean; selected: boolean;
@ -13,8 +15,11 @@ const NodeWrapper = (props: NodeWrapperProps) => {
'dark-lg', 'dark-lg',
]); ]);
const shift = useAppSelector((state) => state.hotkeys.shift);
return ( return (
<Box <Box
className={shift ? DRAG_HANDLE_CLASSNAME : 'nopan'}
sx={{ sx={{
position: 'relative', position: 'relative',
borderRadius: 'md', borderRadius: 'md',

View File

@ -23,7 +23,6 @@ const ProgressImageNode = (props: NodeProps<InvocationValue>) => {
<Flex <Flex
className="nopan" className="nopan"
sx={{ sx={{
cursor: 'auto',
flexDirection: 'column', flexDirection: 'column',
borderBottomRadius: 'md', borderBottomRadius: 'md',
p: 2, p: 2,