11import { useDndContext } from '@dnd-kit/core' ;
22import { Box , Button , Spacer , Tab , TabList , TabPanel , TabPanels , Tabs } from '@invoke-ai/ui-library' ;
33import { useAppDispatch , useAppSelector } from 'app/store/storeHooks' ;
4+ import IAIDropOverlay from 'common/components/IAIDropOverlay' ;
45import { CanvasLayersPanelContent } from 'features/controlLayers/components/CanvasLayersPanelContent' ;
56import { CanvasManagerProviderGate } from 'features/controlLayers/contexts/CanvasManagerProviderGate' ;
67import { selectEntityCountActive } from 'features/controlLayers/store/selectors' ;
@@ -9,7 +10,7 @@ import { useImageViewer } from 'features/gallery/components/ImageViewer/useImage
910import { useRegisteredHotkeys } from 'features/system/components/HotkeysModal/useHotkeyData' ;
1011import { selectActiveTabCanvasRightPanel } from 'features/ui/store/uiSelectors' ;
1112import { activeTabCanvasRightPanelChanged } from 'features/ui/store/uiSlice' ;
12- import { memo , useCallback , useMemo , useRef } from 'react' ;
13+ import { memo , useCallback , useMemo , useRef , useState } from 'react' ;
1314import { useTranslation } from 'react-i18next' ;
1415
1516export const CanvasRightPanel = memo ( ( ) => {
@@ -78,12 +79,15 @@ CanvasRightPanel.displayName = 'CanvasRightPanel';
7879
7980const PanelTabs = memo ( ( ) => {
8081 const { t } = useTranslation ( ) ;
82+ const activeTab = useAppSelector ( selectActiveTabCanvasRightPanel ) ;
8183 const activeEntityCount = useAppSelector ( selectEntityCountActive ) ;
8284 const tabTimeout = useRef < number | null > ( null ) ;
8385 const dndCtx = useDndContext ( ) ;
8486 const dispatch = useAppDispatch ( ) ;
87+ const [ mouseOverTab , setMouseOverTab ] = useState < 'layers' | 'gallery' | null > ( null ) ;
8588
8689 const onOnMouseOverLayersTab = useCallback ( ( ) => {
90+ setMouseOverTab ( 'layers' ) ;
8791 tabTimeout . current = window . setTimeout ( ( ) => {
8892 if ( dndCtx . active ) {
8993 dispatch ( activeTabCanvasRightPanelChanged ( 'layers' ) ) ;
@@ -92,6 +96,7 @@ const PanelTabs = memo(() => {
9296 } , [ dndCtx . active , dispatch ] ) ;
9397
9498 const onOnMouseOverGalleryTab = useCallback ( ( ) => {
99+ setMouseOverTab ( 'gallery' ) ;
95100 tabTimeout . current = window . setTimeout ( ( ) => {
96101 if ( dndCtx . active ) {
97102 dispatch ( activeTabCanvasRightPanelChanged ( 'gallery' ) ) ;
@@ -100,6 +105,7 @@ const PanelTabs = memo(() => {
100105 } , [ dndCtx . active , dispatch ] ) ;
101106
102107 const onMouseOut = useCallback ( ( ) => {
108+ setMouseOverTab ( null ) ;
103109 if ( tabTimeout . current ) {
104110 clearTimeout ( tabTimeout . current ) ;
105111 }
@@ -118,9 +124,17 @@ const PanelTabs = memo(() => {
118124 < Box as = "span" w = "full" >
119125 { layersTabLabel }
120126 </ Box >
127+ { dndCtx . active && activeTab !== 'layers' && (
128+ < IAIDropOverlay isOver = { mouseOverTab === 'layers' } withBackdrop = { false } />
129+ ) }
121130 </ Tab >
122- < Tab position = "relative" onMouseOver = { onOnMouseOverGalleryTab } onMouseOut = { onMouseOut } >
123- { t ( 'gallery.gallery' ) }
131+ < Tab position = "relative" onMouseOver = { onOnMouseOverGalleryTab } onMouseOut = { onMouseOut } w = { 32 } >
132+ < Box as = "span" w = "full" >
133+ { t ( 'gallery.gallery' ) }
134+ </ Box >
135+ { dndCtx . active && activeTab !== 'gallery' && (
136+ < IAIDropOverlay isOver = { mouseOverTab === 'gallery' } withBackdrop = { false } />
137+ ) }
124138 </ Tab >
125139 </ >
126140 ) ;
0 commit comments