mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix mouse interactions
This commit is contained in:
parent
e8d531b987
commit
0257b4a611
@ -1,4 +1,5 @@
|
|||||||
import { Flex, Heading, Icon, Tooltip } from '@chakra-ui/react';
|
import { Flex, Heading, Icon, Tooltip } from '@chakra-ui/react';
|
||||||
|
import { DRAG_HANDLE_CLASSNAME } from 'features/nodes/hooks/useBuildInvocation';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
import { FaInfoCircle } from 'react-icons/fa';
|
import { FaInfoCircle } from 'react-icons/fa';
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ const IAINodeHeader = (props: IAINodeHeaderProps) => {
|
|||||||
const { nodeId, title, description } = props;
|
const { nodeId, title, description } = props;
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
|
className={DRAG_HANDLE_CLASSNAME}
|
||||||
sx={{
|
sx={{
|
||||||
borderTopRadius: 'md',
|
borderTopRadius: 'md',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
import {
|
|
||||||
InputFieldTemplate,
|
|
||||||
InputFieldValue,
|
|
||||||
InvocationTemplate,
|
|
||||||
} from 'features/nodes/types/types';
|
|
||||||
import { memo, ReactNode, useCallback } from 'react';
|
|
||||||
import { map } from 'lodash-es';
|
|
||||||
import { useAppSelector } from 'app/store/storeHooks';
|
|
||||||
import { RootState } from 'app/store/store';
|
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
|
Divider,
|
||||||
Flex,
|
Flex,
|
||||||
FormControl,
|
FormControl,
|
||||||
FormLabel,
|
FormLabel,
|
||||||
HStack,
|
HStack,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Divider,
|
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import FieldHandle from '../FieldHandle';
|
import { RootState } from 'app/store/store';
|
||||||
|
import { useAppSelector } from 'app/store/storeHooks';
|
||||||
import { useIsValidConnection } from 'features/nodes/hooks/useIsValidConnection';
|
import { useIsValidConnection } from 'features/nodes/hooks/useIsValidConnection';
|
||||||
import InputFieldComponent from '../InputFieldComponent';
|
|
||||||
import { HANDLE_TOOLTIP_OPEN_DELAY } from 'features/nodes/types/constants';
|
import { HANDLE_TOOLTIP_OPEN_DELAY } from 'features/nodes/types/constants';
|
||||||
|
import {
|
||||||
|
InputFieldTemplate,
|
||||||
|
InputFieldValue,
|
||||||
|
InvocationTemplate,
|
||||||
|
} from 'features/nodes/types/types';
|
||||||
|
import { map } from 'lodash-es';
|
||||||
|
import { ReactNode, memo, useCallback } from 'react';
|
||||||
|
import FieldHandle from '../FieldHandle';
|
||||||
|
import InputFieldComponent from '../InputFieldComponent';
|
||||||
|
|
||||||
interface IAINodeInputProps {
|
interface IAINodeInputProps {
|
||||||
nodeId: string;
|
nodeId: string;
|
||||||
@ -35,6 +35,7 @@ function IAINodeInput(props: IAINodeInputProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
|
className="nopan"
|
||||||
position="relative"
|
position="relative"
|
||||||
borderColor={
|
borderColor={
|
||||||
!template
|
!template
|
||||||
@ -136,7 +137,7 @@ const IAINodeInputs = (props: IAINodeInputsProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex flexDir="column" gap={2} p={2}>
|
<Flex className="nopan" flexDir="column" gap={2} p={2}>
|
||||||
{IAINodeInputsToRender}
|
{IAINodeInputsToRender}
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
|
@ -23,7 +23,14 @@ export const InvocationComponent = memo((props: NodeProps<InvocationValue>) => {
|
|||||||
if (!template) {
|
if (!template) {
|
||||||
return (
|
return (
|
||||||
<NodeWrapper selected={selected}>
|
<NodeWrapper selected={selected}>
|
||||||
<Flex sx={{ alignItems: 'center', justifyContent: 'center' }}>
|
<Flex
|
||||||
|
className="nopan"
|
||||||
|
sx={{
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
cursor: 'auto',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Icon
|
<Icon
|
||||||
as={FaExclamationCircle}
|
as={FaExclamationCircle}
|
||||||
sx={{
|
sx={{
|
||||||
@ -46,12 +53,14 @@ export const InvocationComponent = memo((props: NodeProps<InvocationValue>) => {
|
|||||||
description={template.description}
|
description={template.description}
|
||||||
/>
|
/>
|
||||||
<Flex
|
<Flex
|
||||||
|
className="nopan"
|
||||||
sx={{
|
sx={{
|
||||||
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} />
|
||||||
|
@ -21,7 +21,9 @@ const ProgressImageNode = (props: NodeProps<InvocationValue>) => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Flex
|
<Flex
|
||||||
|
className="nopan"
|
||||||
sx={{
|
sx={{
|
||||||
|
cursor: 'auto',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
borderBottomRadius: 'md',
|
borderBottomRadius: 'md',
|
||||||
p: 2,
|
p: 2,
|
||||||
|
@ -18,6 +18,12 @@ const templatesSelector = createSelector(
|
|||||||
(nodes) => nodes.invocationTemplates
|
(nodes) => nodes.invocationTemplates
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const DRAG_HANDLE_CLASSNAME = 'node-drag-handle';
|
||||||
|
|
||||||
|
export const SHARED_NODE_PROPERTIES: Partial<Node> = {
|
||||||
|
dragHandle: `.${DRAG_HANDLE_CLASSNAME}`,
|
||||||
|
};
|
||||||
|
|
||||||
export const useBuildInvocation = () => {
|
export const useBuildInvocation = () => {
|
||||||
const invocationTemplates = useAppSelector(templatesSelector);
|
const invocationTemplates = useAppSelector(templatesSelector);
|
||||||
|
|
||||||
@ -32,6 +38,7 @@ export const useBuildInvocation = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const node: Node = {
|
const node: Node = {
|
||||||
|
...SHARED_NODE_PROPERTIES,
|
||||||
id: 'progress_image',
|
id: 'progress_image',
|
||||||
type: 'progress_image',
|
type: 'progress_image',
|
||||||
position: { x: x, y: y },
|
position: { x: x, y: y },
|
||||||
@ -91,6 +98,7 @@ export const useBuildInvocation = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const invocation: Node<InvocationValue> = {
|
const invocation: Node<InvocationValue> = {
|
||||||
|
...SHARED_NODE_PROPERTIES,
|
||||||
id: nodeId,
|
id: nodeId,
|
||||||
type: 'invocation',
|
type: 'invocation',
|
||||||
position: { x: x, y: y },
|
position: { x: x, y: y },
|
||||||
|
Loading…
Reference in New Issue
Block a user