-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00fa736
commit 4467997
Showing
52 changed files
with
644 additions
and
616 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
invokeai/frontend/web/src/features/controlLayers/components/CanvasEditor.stories.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
invokeai/frontend/web/src/features/controlLayers/components/CanvasRightPanel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { useDndContext } from '@dnd-kit/core'; | ||
import { Box, Spacer, Tab, TabList, TabPanel, TabPanels, Tabs } from '@invoke-ai/ui-library'; | ||
import { useAppSelector } from 'app/store/storeHooks'; | ||
import { useScopeOnFocus } from 'common/hooks/interactionScopes'; | ||
import { CanvasPanelContent } from 'features/controlLayers/components/CanvasPanelContent'; | ||
import { CanvasSendToToggle } from 'features/controlLayers/components/CanvasSendToToggle'; | ||
import { selectSendToCanvas } from 'features/controlLayers/store/canvasSettingsSlice'; | ||
import GalleryPanelContent from 'features/gallery/components/GalleryPanelContent'; | ||
import { memo, useCallback, useRef, useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
export const CanvasRightPanelContent = memo(() => { | ||
const ref = useRef<HTMLDivElement>(null); | ||
const [tab, setTab] = useState(0); | ||
useScopeOnFocus('gallery', ref); | ||
|
||
return ( | ||
<Tabs index={tab} onChange={setTab} w="full" h="full" display="flex" flexDir="column"> | ||
<TabList alignItems="center"> | ||
<PanelTabs setTab={setTab} /> | ||
<Spacer /> | ||
<CanvasSendToToggle /> | ||
</TabList> | ||
<TabPanels w="full" h="full"> | ||
<TabPanel w="full" h="full" p={0} pt={2}> | ||
<GalleryPanelContent /> | ||
</TabPanel> | ||
<TabPanel w="full" h="full" p={0} pt={2}> | ||
<CanvasPanelContent /> | ||
</TabPanel> | ||
</TabPanels> | ||
</Tabs> | ||
); | ||
}); | ||
|
||
CanvasRightPanelContent.displayName = 'CanvasRightPanelContent'; | ||
|
||
const PanelTabs = memo(({ setTab }: { setTab: (val: number) => void }) => { | ||
const { t } = useTranslation(); | ||
const sendToCanvas = useAppSelector(selectSendToCanvas); | ||
const tabTimeout = useRef<number | null>(null); | ||
const dndCtx = useDndContext(); | ||
|
||
const onOnMouseOverLayersTab = useCallback(() => { | ||
tabTimeout.current = window.setTimeout(() => { | ||
if (dndCtx.active) { | ||
setTab(1); | ||
} | ||
}, 300); | ||
}, [dndCtx.active, setTab]); | ||
|
||
const onOnMouseOverGalleryTab = useCallback(() => { | ||
tabTimeout.current = window.setTimeout(() => { | ||
if (dndCtx.active) { | ||
setTab(0); | ||
} | ||
}, 300); | ||
}, [dndCtx.active, setTab]); | ||
|
||
const onMouseOut = useCallback(() => { | ||
if (tabTimeout.current) { | ||
clearTimeout(tabTimeout.current); | ||
} | ||
}, []); | ||
return ( | ||
<> | ||
<Tab position="relative" onMouseOver={onOnMouseOverGalleryTab} onMouseOut={onMouseOut}> | ||
{t('gallery.gallery')} | ||
{!sendToCanvas && ( | ||
<Box position="absolute" top={2} right={2} h={2} w={2} bg="invokeYellow.300" borderRadius="full" /> | ||
)} | ||
</Tab> | ||
<Tab position="relative" onMouseOver={onOnMouseOverLayersTab} onMouseOut={onMouseOut}> | ||
{t('controlLayers.layer_other')} | ||
{sendToCanvas && ( | ||
<Box position="absolute" top={2} right={2} h={2} w={2} bg="invokeYellow.300" borderRadius="full" /> | ||
)} | ||
</Tab> | ||
</> | ||
); | ||
}); | ||
|
||
PanelTabs.displayName = 'PanelTabs'; |
Oops, something went wrong.