mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Adds escape hotkey to close floating panels
This commit is contained in:
parent
a1971f6830
commit
1f0bd3ca6c
@ -163,6 +163,15 @@ export default function ImageGallery() {
|
|||||||
[shouldPinGallery]
|
[shouldPinGallery]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useHotkeys(
|
||||||
|
'esc',
|
||||||
|
() => {
|
||||||
|
if (shouldPinGallery) return;
|
||||||
|
dispatch(setShouldShowGallery(false));
|
||||||
|
},
|
||||||
|
[shouldPinGallery]
|
||||||
|
);
|
||||||
|
|
||||||
const IMAGE_SIZE_STEP = 32;
|
const IMAGE_SIZE_STEP = 32;
|
||||||
|
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
|
@ -32,10 +32,12 @@ import {
|
|||||||
setUpscalingStrength,
|
setUpscalingStrength,
|
||||||
setWidth,
|
setWidth,
|
||||||
setInitialImage,
|
setInitialImage,
|
||||||
|
setShouldShowImageDetails,
|
||||||
} from '../../options/optionsSlice';
|
} from '../../options/optionsSlice';
|
||||||
import promptToString from '../../../common/util/promptToString';
|
import promptToString from '../../../common/util/promptToString';
|
||||||
import { seedWeightsToString } from '../../../common/util/seedWeightPairs';
|
import { seedWeightsToString } from '../../../common/util/seedWeightPairs';
|
||||||
import { FaCopy } from 'react-icons/fa';
|
import { FaCopy } from 'react-icons/fa';
|
||||||
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
|
|
||||||
type MetadataItemProps = {
|
type MetadataItemProps = {
|
||||||
isLink?: boolean;
|
isLink?: boolean;
|
||||||
@ -107,7 +109,10 @@ const memoEqualityCheck = (
|
|||||||
const ImageMetadataViewer = memo(
|
const ImageMetadataViewer = memo(
|
||||||
({ image, styleClass }: ImageMetadataViewerProps) => {
|
({ image, styleClass }: ImageMetadataViewerProps) => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
// const jsonBgColor = useColorModeValue('blackAlpha.100', 'whiteAlpha.100');
|
|
||||||
|
useHotkeys('esc', () => {
|
||||||
|
dispatch(setShouldShowImageDetails(false));
|
||||||
|
});
|
||||||
|
|
||||||
const metadata = image?.metadata?.image || {};
|
const metadata = image?.metadata?.image || {};
|
||||||
const {
|
const {
|
||||||
|
@ -75,6 +75,10 @@ const Console = () => {
|
|||||||
[shouldShowLogViewer]
|
[shouldShowLogViewer]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useHotkeys('esc', () => {
|
||||||
|
dispatch(setShouldShowLogViewer(false));
|
||||||
|
});
|
||||||
|
|
||||||
const handleOnScroll = () => {
|
const handleOnScroll = () => {
|
||||||
if (!viewerRef.current) return;
|
if (!viewerRef.current) return;
|
||||||
if (
|
if (
|
||||||
|
@ -100,6 +100,7 @@ export default function HotkeysModal({ children }: HotkeysModalProps) {
|
|||||||
hotkey: 'Shift+I',
|
hotkey: 'Shift+I',
|
||||||
},
|
},
|
||||||
{ title: 'Delete Image', desc: 'Delete the current image', hotkey: 'Del' },
|
{ title: 'Delete Image', desc: 'Delete the current image', hotkey: 'Del' },
|
||||||
|
{ title: 'Close Panels', desc: 'Closes open panels', hotkey: 'Esc' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const galleryHotkeys = [
|
const galleryHotkeys = [
|
||||||
|
@ -67,6 +67,15 @@ const InvokeOptionsPanel = (props: Props) => {
|
|||||||
[shouldShowOptionsPanel]
|
[shouldShowOptionsPanel]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useHotkeys(
|
||||||
|
'esc',
|
||||||
|
() => {
|
||||||
|
if (shouldPinOptionsPanel) return;
|
||||||
|
dispatch(setShouldShowOptionsPanel(false));
|
||||||
|
},
|
||||||
|
[shouldPinOptionsPanel]
|
||||||
|
);
|
||||||
|
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
'shift+o',
|
'shift+o',
|
||||||
() => {
|
() => {
|
||||||
@ -74,7 +83,6 @@ const InvokeOptionsPanel = (props: Props) => {
|
|||||||
},
|
},
|
||||||
[shouldPinOptionsPanel]
|
[shouldPinOptionsPanel]
|
||||||
);
|
);
|
||||||
//
|
|
||||||
|
|
||||||
const handleCloseOptionsPanel = useCallback(() => {
|
const handleCloseOptionsPanel = useCallback(() => {
|
||||||
if (shouldPinOptionsPanel) return;
|
if (shouldPinOptionsPanel) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user