mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): do not select already-selected entity
This commit is contained in:
parent
b4c3c940b5
commit
89de04775e
@ -1,7 +1,7 @@
|
|||||||
import type { ChakraProps } from '@invoke-ai/ui-library';
|
import type { ChakraProps } from '@invoke-ai/ui-library';
|
||||||
import { Flex } from '@invoke-ai/ui-library';
|
import { Flex } from '@invoke-ai/ui-library';
|
||||||
import type { PropsWithChildren } from 'react';
|
import type { PropsWithChildren } from 'react';
|
||||||
import { memo, useMemo } from 'react';
|
import { memo, useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
type Props = PropsWithChildren<{
|
type Props = PropsWithChildren<{
|
||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
@ -16,11 +16,18 @@ export const CanvasEntityContainer = memo(({ isSelected, onSelect, selectedBorde
|
|||||||
}
|
}
|
||||||
return 'base.800';
|
return 'base.800';
|
||||||
}, [isSelected, selectedBorderColor]);
|
}, [isSelected, selectedBorderColor]);
|
||||||
|
const _onSelect = useCallback(() => {
|
||||||
|
if (isSelected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
onSelect();
|
||||||
|
}, [isSelected, onSelect]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
position="relative"
|
position="relative"
|
||||||
gap={2}
|
gap={2}
|
||||||
onClick={onSelect}
|
onClick={_onSelect}
|
||||||
bg={bg}
|
bg={bg}
|
||||||
px={2}
|
px={2}
|
||||||
borderRadius="base"
|
borderRadius="base"
|
||||||
|
Loading…
Reference in New Issue
Block a user