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 { Flex } from '@invoke-ai/ui-library';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
import { memo, useMemo } from 'react';
|
||||
import { memo, useCallback, useMemo } from 'react';
|
||||
|
||||
type Props = PropsWithChildren<{
|
||||
isSelected: boolean;
|
||||
@ -16,11 +16,18 @@ export const CanvasEntityContainer = memo(({ isSelected, onSelect, selectedBorde
|
||||
}
|
||||
return 'base.800';
|
||||
}, [isSelected, selectedBorderColor]);
|
||||
const _onSelect = useCallback(() => {
|
||||
if (isSelected) {
|
||||
return;
|
||||
}
|
||||
onSelect();
|
||||
}, [isSelected, onSelect]);
|
||||
|
||||
return (
|
||||
<Flex
|
||||
position="relative"
|
||||
gap={2}
|
||||
onClick={onSelect}
|
||||
onClick={_onSelect}
|
||||
bg={bg}
|
||||
px={2}
|
||||
borderRadius="base"
|
||||
|
Loading…
Reference in New Issue
Block a user