mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix: Shift O and Shift G not resizing the canvas correctly
This commit is contained in:
parent
ab2343da51
commit
f803d5cf1e
@ -16,10 +16,11 @@ import React, { memo } from 'react';
|
|||||||
import { isHotkeyPressed, useHotkeys } from 'react-hotkeys-hook';
|
import { isHotkeyPressed, useHotkeys } from 'react-hotkeys-hook';
|
||||||
|
|
||||||
const globalHotkeysSelector = createSelector(
|
const globalHotkeysSelector = createSelector(
|
||||||
(state: RootState) => state.hotkeys,
|
[(state: RootState) => state.hotkeys, (state: RootState) => state.ui],
|
||||||
(hotkeys) => {
|
(hotkeys, ui) => {
|
||||||
const { shift } = hotkeys;
|
const { shift } = hotkeys;
|
||||||
return { shift };
|
const { shouldPinParametersPanel, shouldPinGallery } = ui;
|
||||||
|
return { shift, shouldPinGallery, shouldPinParametersPanel };
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
memoizeOptions: {
|
memoizeOptions: {
|
||||||
@ -36,7 +37,9 @@ const globalHotkeysSelector = createSelector(
|
|||||||
*/
|
*/
|
||||||
const GlobalHotkeys: React.FC = () => {
|
const GlobalHotkeys: React.FC = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { shift } = useAppSelector(globalHotkeysSelector);
|
const { shift, shouldPinParametersPanel, shouldPinGallery } = useAppSelector(
|
||||||
|
globalHotkeysSelector
|
||||||
|
);
|
||||||
const activeTabName = useAppSelector(activeTabNameSelector);
|
const activeTabName = useAppSelector(activeTabNameSelector);
|
||||||
|
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
@ -54,24 +57,30 @@ const GlobalHotkeys: React.FC = () => {
|
|||||||
|
|
||||||
useHotkeys('o', () => {
|
useHotkeys('o', () => {
|
||||||
dispatch(toggleParametersPanel());
|
dispatch(toggleParametersPanel());
|
||||||
if (activeTabName === 'unifiedCanvas') {
|
if (activeTabName === 'unifiedCanvas' && shouldPinParametersPanel) {
|
||||||
dispatch(requestCanvasRescale());
|
dispatch(requestCanvasRescale());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
useHotkeys(['shift+o'], () => {
|
useHotkeys(['shift+o'], () => {
|
||||||
dispatch(togglePinParametersPanel());
|
dispatch(togglePinParametersPanel());
|
||||||
|
if (activeTabName === 'unifiedCanvas') {
|
||||||
|
dispatch(requestCanvasRescale());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
useHotkeys('g', () => {
|
useHotkeys('g', () => {
|
||||||
dispatch(toggleGalleryPanel());
|
dispatch(toggleGalleryPanel());
|
||||||
if (activeTabName === 'unifiedCanvas') {
|
if (activeTabName === 'unifiedCanvas' && shouldPinGallery) {
|
||||||
dispatch(requestCanvasRescale());
|
dispatch(requestCanvasRescale());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
useHotkeys(['shift+g'], () => {
|
useHotkeys(['shift+g'], () => {
|
||||||
dispatch(togglePinGalleryPanel());
|
dispatch(togglePinGalleryPanel());
|
||||||
|
if (activeTabName === 'unifiedCanvas') {
|
||||||
|
dispatch(requestCanvasRescale());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
useHotkeys('1', () => {
|
useHotkeys('1', () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user