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
556c1dc67b
commit
1686924ac8
@ -2,7 +2,7 @@ import { Flex } from '@invoke-ai/ui-library';
|
|||||||
import { useAppDispatch } from 'app/store/storeHooks';
|
import { useAppDispatch } from 'app/store/storeHooks';
|
||||||
import { useEntityIdentifierContext } from 'features/controlLayers/contexts/EntityIdentifierContext';
|
import { useEntityIdentifierContext } from 'features/controlLayers/contexts/EntityIdentifierContext';
|
||||||
import { useEntitySelectionColor } from 'features/controlLayers/hooks/useEntitySelectionColor';
|
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 { entitySelected } from 'features/controlLayers/store/canvasV2Slice';
|
||||||
import type { PropsWithChildren } from 'react';
|
import type { PropsWithChildren } from 'react';
|
||||||
import { memo, useCallback } from 'react';
|
import { memo, useCallback } from 'react';
|
||||||
@ -10,7 +10,7 @@ import { memo, useCallback } from 'react';
|
|||||||
export const CanvasEntityContainer = memo((props: PropsWithChildren) => {
|
export const CanvasEntityContainer = memo((props: PropsWithChildren) => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const entityIdentifier = useEntityIdentifierContext();
|
const entityIdentifier = useEntityIdentifierContext();
|
||||||
const isSelected = useIsEntitySelected(entityIdentifier);
|
const isSelected = useEntityIsSelected(entityIdentifier);
|
||||||
const selectionColor = useEntitySelectionColor(entityIdentifier);
|
const selectionColor = useEntitySelectionColor(entityIdentifier);
|
||||||
const onClick = useCallback(() => {
|
const onClick = useCallback(() => {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Text } from '@invoke-ai/ui-library';
|
import { Text } from '@invoke-ai/ui-library';
|
||||||
import { useEntityIdentifierContext } from 'features/controlLayers/contexts/EntityIdentifierContext';
|
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 { memo, useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { assert } from 'tsafe';
|
import { assert } from 'tsafe';
|
||||||
@ -8,7 +8,7 @@ import { assert } from 'tsafe';
|
|||||||
export const CanvasEntityTitle = memo(() => {
|
export const CanvasEntityTitle = memo(() => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const entityIdentifier = useEntityIdentifierContext();
|
const entityIdentifier = useEntityIdentifierContext();
|
||||||
const isSelected = useIsEntitySelected(entityIdentifier);
|
const isSelected = useEntityIsSelected(entityIdentifier);
|
||||||
const title = useMemo(() => {
|
const title = useMemo(() => {
|
||||||
if (entityIdentifier.type === 'inpaint_mask') {
|
if (entityIdentifier.type === 'inpaint_mask') {
|
||||||
return t('controlLayers.inpaintMask');
|
return t('controlLayers.inpaintMask');
|
||||||
|
@ -2,7 +2,7 @@ import { useAppSelector } from 'app/store/storeHooks';
|
|||||||
import type { CanvasEntityIdentifier } from 'features/controlLayers/store/types';
|
import type { CanvasEntityIdentifier } from 'features/controlLayers/store/types';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
export const useIsEntitySelected = (entityIdentifier: CanvasEntityIdentifier) => {
|
export const useEntityIsSelected = (entityIdentifier: CanvasEntityIdentifier) => {
|
||||||
const selectedEntityIdentifier = useAppSelector((s) => s.canvasV2.selectedEntityIdentifier);
|
const selectedEntityIdentifier = useAppSelector((s) => s.canvasV2.selectedEntityIdentifier);
|
||||||
const isSelected = useMemo(() => {
|
const isSelected = useMemo(() => {
|
||||||
return selectedEntityIdentifier?.id === entityIdentifier.id;
|
return selectedEntityIdentifier?.id === entityIdentifier.id;
|
Loading…
Reference in New Issue
Block a user