diff --git a/invokeai/frontend/web/src/common/components/OverlayScrollbars/ScrollableContent.tsx b/invokeai/frontend/web/src/common/components/OverlayScrollbars/ScrollableContent.tsx index 2e4b61a0a5..b78fd3d3a6 100644 --- a/invokeai/frontend/web/src/common/components/OverlayScrollbars/ScrollableContent.tsx +++ b/invokeai/frontend/web/src/common/components/OverlayScrollbars/ScrollableContent.tsx @@ -1,24 +1,35 @@ import type { ChakraProps } from '@invoke-ai/ui'; import { Box, Flex } from '@invoke-ai/ui'; -import { overlayScrollbarsParams } from 'common/components/OverlayScrollbars/constants'; +import { getOverlayScrollbarsParams } from 'common/components/OverlayScrollbars/constants'; import { OverlayScrollbarsComponent } from 'overlayscrollbars-react'; import type { CSSProperties, PropsWithChildren } from 'react'; -import { memo } from 'react'; +import { memo, useMemo } from 'react'; type Props = PropsWithChildren & { maxHeight?: ChakraProps['maxHeight']; + overflowX?: 'hidden' | 'scroll'; + overflowY?: 'hidden' | 'scroll'; }; const styles: CSSProperties = { height: '100%', width: '100%' }; -const ScrollableContent = ({ children, maxHeight }: Props) => { +const ScrollableContent = ({ + children, + maxHeight, + overflowX = 'hidden', + overflowY = 'scroll', +}: Props) => { + const overlayscrollbarsOptions = useMemo( + () => getOverlayScrollbarsParams(overflowX, overflowY).options, + [overflowX, overflowY] + ); return ( {children} diff --git a/invokeai/frontend/web/src/common/components/OverlayScrollbars/constants.ts b/invokeai/frontend/web/src/common/components/OverlayScrollbars/constants.ts index fa6969b2ed..4ec4b5620d 100644 --- a/invokeai/frontend/web/src/common/components/OverlayScrollbars/constants.ts +++ b/invokeai/frontend/web/src/common/components/OverlayScrollbars/constants.ts @@ -1,3 +1,4 @@ +import { cloneDeep, merge } from 'lodash-es'; import { ClickScrollPlugin, OverlayScrollbars } from 'overlayscrollbars'; import type { UseOverlayScrollbarsParams } from 'overlayscrollbars-react'; @@ -16,3 +17,12 @@ export const overlayScrollbarsParams: UseOverlayScrollbarsParams = { overflow: { x: 'hidden' }, }, }; + +export const getOverlayScrollbarsParams = ( + overflowX: 'hidden' | 'scroll' = 'hidden', + overflowY: 'hidden' | 'scroll' = 'scroll' +) => { + const params = cloneDeep(overlayScrollbarsParams); + merge(params, { options: { overflow: { y: overflowY, x: overflowX } } }); + return params; +}; diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageMetadataViewer/DataViewer.tsx b/invokeai/frontend/web/src/features/gallery/components/ImageMetadataViewer/DataViewer.tsx index 23c59f3af4..b8268c9676 100644 --- a/invokeai/frontend/web/src/features/gallery/components/ImageMetadataViewer/DataViewer.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/ImageMetadataViewer/DataViewer.tsx @@ -1,5 +1,7 @@ import { Box, Flex, IconButton, Tooltip } from '@invoke-ai/ui'; -import { overlayScrollbarsParams } from 'common/components/OverlayScrollbars/constants'; +import { + getOverlayScrollbarsParams, +} from 'common/components/OverlayScrollbars/constants'; import { isString } from 'lodash-es'; import { OverlayScrollbarsComponent } from 'overlayscrollbars-react'; import type { CSSProperties } from 'react'; @@ -15,6 +17,11 @@ type Props = { withCopy?: boolean; }; +const overlayscrollbarsOptions = getOverlayScrollbarsParams( + 'scroll', + 'scroll' +).options; + const DataViewer = (props: Props) => { const { label, data, fileName, withDownload = true, withCopy = true } = props; const dataString = useMemo( @@ -60,7 +67,7 @@ const DataViewer = (props: Props) => {
{dataString}
diff --git a/invokeai/frontend/web/src/features/queue/components/QueueList/QueueItemDetail.tsx b/invokeai/frontend/web/src/features/queue/components/QueueList/QueueItemDetail.tsx index 0af1948c55..2401962e98 100644 --- a/invokeai/frontend/web/src/features/queue/components/QueueList/QueueItemDetail.tsx +++ b/invokeai/frontend/web/src/features/queue/components/QueueList/QueueItemDetail.tsx @@ -6,7 +6,6 @@ import { Spinner, Text, } from '@invoke-ai/ui'; -import ScrollableContent from 'common/components/OverlayScrollbars/ScrollableContent'; import DataViewer from 'features/gallery/components/ImageMetadataViewer/DataViewer'; import { useCancelBatch } from 'features/queue/hooks/useCancelBatch'; import { useCancelQueueItem } from 'features/queue/hooks/useCancelQueueItem'; @@ -127,9 +126,7 @@ const QueueItemComponent = ({ queueItemDTO }: Props) => { justifyContent="center" > {queueItem ? ( - - - + ) : ( )}