mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
refactor(ui): undo/redo button temp fix
This commit is contained in:
parent
1f85888638
commit
0e7b10d3d9
@ -1,7 +1,6 @@
|
|||||||
/* eslint-disable i18next/no-literal-string */
|
/* eslint-disable i18next/no-literal-string */
|
||||||
import { ButtonGroup, IconButton } from '@invoke-ai/ui-library';
|
import { ButtonGroup, IconButton } from '@invoke-ai/ui-library';
|
||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppSelector } from 'app/store/storeHooks';
|
||||||
import { redo, undo } from 'features/controlLayers/store/canvasV2Slice';
|
|
||||||
import { memo, useCallback } from 'react';
|
import { memo, useCallback } from 'react';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -9,18 +8,19 @@ import { PiArrowClockwiseBold, PiArrowCounterClockwiseBold } from 'react-icons/p
|
|||||||
|
|
||||||
export const UndoRedoButtonGroup = memo(() => {
|
export const UndoRedoButtonGroup = memo(() => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const dispatch = useAppDispatch();
|
|
||||||
|
|
||||||
const mayUndo = useAppSelector((s) => s.controlLayers.past.length > 0);
|
const mayUndo = useAppSelector(() => false);
|
||||||
const handleUndo = useCallback(() => {
|
const handleUndo = useCallback(() => {
|
||||||
dispatch(undo());
|
// TODO(psyche): Implement undo
|
||||||
}, [dispatch]);
|
// dispatch(undo());
|
||||||
|
}, []);
|
||||||
useHotkeys(['meta+z', 'ctrl+z'], handleUndo, { enabled: mayUndo, preventDefault: true }, [mayUndo, handleUndo]);
|
useHotkeys(['meta+z', 'ctrl+z'], handleUndo, { enabled: mayUndo, preventDefault: true }, [mayUndo, handleUndo]);
|
||||||
|
|
||||||
const mayRedo = useAppSelector((s) => s.controlLayers.future.length > 0);
|
const mayRedo = useAppSelector(() => false);
|
||||||
const handleRedo = useCallback(() => {
|
const handleRedo = useCallback(() => {
|
||||||
dispatch(redo());
|
// TODO(psyche): Implement redo
|
||||||
}, [dispatch]);
|
// dispatch(redo());
|
||||||
|
}, []);
|
||||||
useHotkeys(['meta+shift+z', 'ctrl+shift+z'], handleRedo, { enabled: mayRedo, preventDefault: true }, [
|
useHotkeys(['meta+shift+z', 'ctrl+shift+z'], handleRedo, { enabled: mayRedo, preventDefault: true }, [
|
||||||
mayRedo,
|
mayRedo,
|
||||||
handleRedo,
|
handleRedo,
|
||||||
|
Loading…
Reference in New Issue
Block a user