mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
tidy(ui): "useIsEntitySelected" -> "useEntityIsSelected"
This commit is contained in:
parent
3c86f1e979
commit
bdce958f29
@ -2,7 +2,7 @@ import { Flex } from '@invoke-ai/ui-library';
|
||||
import { useAppDispatch } from 'app/store/storeHooks';
|
||||
import { useEntityIdentifierContext } from 'features/controlLayers/contexts/EntityIdentifierContext';
|
||||
import { useEntitySelectionColor } from 'features/controlLayers/hooks/useEntitySelectionColor';
|
||||
import { useIsEntitySelected } from 'features/controlLayers/hooks/useIsEntitySelected';
|
||||
import { useEntityIsSelected } from 'features/controlLayers/hooks/useEntityIsSelected';
|
||||
import { entitySelected } from 'features/controlLayers/store/canvasV2Slice';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
import { memo, useCallback } from 'react';
|
||||
@ -10,7 +10,7 @@ import { memo, useCallback } from 'react';
|
||||
export const CanvasEntityContainer = memo((props: PropsWithChildren) => {
|
||||
const dispatch = useAppDispatch();
|
||||
const entityIdentifier = useEntityIdentifierContext();
|
||||
const isSelected = useIsEntitySelected(entityIdentifier);
|
||||
const isSelected = useEntityIsSelected(entityIdentifier);
|
||||
const selectionColor = useEntitySelectionColor(entityIdentifier);
|
||||
const onClick = useCallback(() => {
|
||||
if (isSelected) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Text } from '@invoke-ai/ui-library';
|
||||
import { useEntityIdentifierContext } from 'features/controlLayers/contexts/EntityIdentifierContext';
|
||||
import { useIsEntitySelected } from 'features/controlLayers/hooks/useIsEntitySelected';
|
||||
import { useEntityIsSelected } from 'features/controlLayers/hooks/useEntityIsSelected';
|
||||
import { memo, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { assert } from 'tsafe';
|
||||
@ -8,7 +8,7 @@ import { assert } from 'tsafe';
|
||||
export const CanvasEntityTitle = memo(() => {
|
||||
const { t } = useTranslation();
|
||||
const entityIdentifier = useEntityIdentifierContext();
|
||||
const isSelected = useIsEntitySelected(entityIdentifier);
|
||||
const isSelected = useEntityIsSelected(entityIdentifier);
|
||||
const title = useMemo(() => {
|
||||
if (entityIdentifier.type === 'inpaint_mask') {
|
||||
return t('controlLayers.inpaintMask');
|
||||
|
@ -2,7 +2,7 @@ import { useAppSelector } from 'app/store/storeHooks';
|
||||
import type { CanvasEntityIdentifier } from 'features/controlLayers/store/types';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export const useIsEntitySelected = (entityIdentifier: CanvasEntityIdentifier) => {
|
||||
export const useEntityIsSelected = (entityIdentifier: CanvasEntityIdentifier) => {
|
||||
const selectedEntityIdentifier = useAppSelector((s) => s.canvasV2.selectedEntityIdentifier);
|
||||
const isSelected = useMemo(() => {
|
||||
return selectedEntityIdentifier?.id === entityIdentifier.id;
|
Loading…
Reference in New Issue
Block a user