mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): use translations for canvas layer select
This commit is contained in:
parent
4ea8416c68
commit
124d49f35e
@ -21,7 +21,6 @@ import {
|
|||||||
setShouldShowBoundingBox,
|
setShouldShowBoundingBox,
|
||||||
} from 'features/canvas/store/canvasSlice';
|
} from 'features/canvas/store/canvasSlice';
|
||||||
import type { CanvasLayer } from 'features/canvas/store/canvasTypes';
|
import type { CanvasLayer } from 'features/canvas/store/canvasTypes';
|
||||||
import { LAYER_NAMES_DICT } from 'features/canvas/store/canvasTypes';
|
|
||||||
import { memo, useCallback, useMemo } from 'react';
|
import { memo, useCallback, useMemo } from 'react';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -216,13 +215,20 @@ const IAICanvasToolbar = () => {
|
|||||||
[dispatch, isMaskEnabled]
|
[dispatch, isMaskEnabled]
|
||||||
);
|
);
|
||||||
|
|
||||||
const value = useMemo(() => LAYER_NAMES_DICT.filter((o) => o.value === layer)[0], [layer]);
|
const layerOptions = useMemo<{ label: string; value: CanvasLayer }[]>(
|
||||||
|
() => [
|
||||||
|
{ label: t('unifiedCanvas.base'), value: 'base' },
|
||||||
|
{ label: t('unifiedCanvas.mask'), value: 'mask' },
|
||||||
|
],
|
||||||
|
[t]
|
||||||
|
);
|
||||||
|
const layerValue = useMemo(() => layerOptions.filter((o) => o.value === layer)[0] ?? null, [layer, layerOptions]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex alignItems="center" gap={2} flexWrap="wrap">
|
<Flex alignItems="center" gap={2} flexWrap="wrap">
|
||||||
<Tooltip label={`${t('unifiedCanvas.layer')} (Q)`}>
|
<Tooltip label={`${t('unifiedCanvas.layer')} (Q)`}>
|
||||||
<FormControl isDisabled={isStaging} w="5rem">
|
<FormControl isDisabled={isStaging} w="5rem">
|
||||||
<Combobox value={value} options={LAYER_NAMES_DICT} onChange={handleChangeLayer} />
|
<Combobox value={layerValue} options={layerOptions} onChange={handleChangeLayer} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
|
@ -5,11 +5,6 @@ import { z } from 'zod';
|
|||||||
|
|
||||||
export type CanvasLayer = 'base' | 'mask';
|
export type CanvasLayer = 'base' | 'mask';
|
||||||
|
|
||||||
export const LAYER_NAMES_DICT: { label: string; value: CanvasLayer }[] = [
|
|
||||||
{ label: 'Base', value: 'base' },
|
|
||||||
{ label: 'Mask', value: 'mask' },
|
|
||||||
];
|
|
||||||
|
|
||||||
const zBoundingBoxScaleMethod = z.enum(['none', 'auto', 'manual']);
|
const zBoundingBoxScaleMethod = z.enum(['none', 'auto', 'manual']);
|
||||||
export type BoundingBoxScaleMethod = z.infer<typeof zBoundingBoxScaleMethod>;
|
export type BoundingBoxScaleMethod = z.infer<typeof zBoundingBoxScaleMethod>;
|
||||||
export const isBoundingBoxScaleMethod = (v: unknown): v is BoundingBoxScaleMethod =>
|
export const isBoundingBoxScaleMethod = (v: unknown): v is BoundingBoxScaleMethod =>
|
||||||
|
Loading…
Reference in New Issue
Block a user