From c1b8e4b5016d78ca9201a4aa71b2d68c9299ea35 Mon Sep 17 00:00:00 2001 From: mickr777 <115216705+mickr777@users.noreply.github.com> Date: Thu, 24 Aug 2023 18:31:27 +1000 Subject: [PATCH] Add Next/Prev Buttons CurrentImageNode.tsx --- .../nodes/CurrentImage/CurrentImageNode.tsx | 122 ++++++++++++------ 1 file changed, 83 insertions(+), 39 deletions(-) diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/CurrentImage/CurrentImageNode.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/CurrentImage/CurrentImageNode.tsx index 6a8a2a3552..c01214a3b3 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/CurrentImage/CurrentImageNode.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/CurrentImage/CurrentImageNode.tsx @@ -1,13 +1,15 @@ -import { Flex, Image, Text } from '@chakra-ui/react'; +import { useState, PropsWithChildren, memo } from 'react'; +import { useSelector } from 'react-redux'; import { createSelector } from '@reduxjs/toolkit'; -import { stateSelector } from 'app/store/store'; +import { Flex, Image, Text } from '@chakra-ui/react'; +import { motion } from 'framer-motion'; +import { NodeProps } from 'reactflow'; +import NodeWrapper from '../common/NodeWrapper'; +import NextPrevImageButtons from 'features/gallery/components/NextPrevImageButtons'; import IAIDndImage from 'common/components/IAIDndImage'; import { IAINoContentFallback } from 'common/components/IAIImageFallback'; import { DRAG_HANDLE_CLASSNAME } from 'features/nodes/types/constants'; -import { PropsWithChildren, memo } from 'react'; -import { useSelector } from 'react-redux'; -import { NodeProps } from 'reactflow'; -import NodeWrapper from '../common/NodeWrapper'; +import { stateSelector } from 'app/store/store'; const selector = createSelector(stateSelector, ({ system, gallery }) => { const imageDTO = gallery.selection[gallery.selection.length - 1]; @@ -54,44 +56,86 @@ const CurrentImageNode = (props: NodeProps) => { export default memo(CurrentImageNode); -const Wrapper = (props: PropsWithChildren<{ nodeProps: NodeProps }>) => ( - - +const Wrapper = (props: PropsWithChildren<{ nodeProps: NodeProps }>) => { + const [isHovering, setIsHovering] = useState(false); + + const handleMouseEnter = () => { + setIsHovering(true); + }; + + const handleMouseLeave = () => { + setIsHovering(false); + }; + + return ( + - - Current Image - + + Current Image + + + + {props.children} + {isHovering && ( + + + + )} + - - {props.children} - - - -); + + ); +};