Styling & Hotkeys Update

This commit is contained in:
blessedcoolant 2022-10-31 04:17:24 +13:00 committed by psychedelicious
parent 5efd2ed7a8
commit 6a6fbe24a3
11 changed files with 58 additions and 28 deletions

View File

@ -3,16 +3,19 @@ import { Button, ButtonProps, Tooltip } from '@chakra-ui/react';
export interface IAIButtonProps extends ButtonProps { export interface IAIButtonProps extends ButtonProps {
label: string; label: string;
tooltip?: string; tooltip?: string;
styleClass?: string;
} }
/** /**
* Reusable customized button component. * Reusable customized button component.
*/ */
const IAIButton = (props: IAIButtonProps) => { const IAIButton = (props: IAIButtonProps) => {
const { label, tooltip = '', ...rest } = props; const { label, tooltip = '', styleClass, ...rest } = props;
return ( return (
<Tooltip label={tooltip}> <Tooltip label={tooltip}>
<Button {...rest}>{label}</Button> <Button className={styleClass ? styleClass : ''} {...rest}>
{label}
</Button>
</Tooltip> </Tooltip>
); );
}; };

View File

@ -19,8 +19,8 @@
} }
.image-gallery-wrapper { .image-gallery-wrapper {
z-index: 10; z-index: 100;
&[data-pinned='false'] { &[data-pinned='false'] {
position: fixed; position: fixed;
height: 100vh; height: 100vh;

View File

@ -156,7 +156,7 @@ export default function ImageGallery() {
}); });
useHotkeys( useHotkeys(
'shift+p', 'shift+g',
() => { () => {
handleSetShouldPinGallery(); handleSetShouldPinGallery();
}, },
@ -443,7 +443,7 @@ export default function ImageGallery() {
size={'sm'} size={'sm'}
className={'image-gallery-icon-btn'} className={'image-gallery-icon-btn'}
aria-label={'Pin Gallery'} aria-label={'Pin Gallery'}
tooltip={'Pin Gallery (Shift+P)'} tooltip={'Pin Gallery (Shift+G)'}
onClick={handleSetShouldPinGallery} onClick={handleSetShouldPinGallery}
icon={shouldPinGallery ? <BsPinAngleFill /> : <BsPinAngle />} icon={shouldPinGallery ? <BsPinAngleFill /> : <BsPinAngle />}
/> />

View File

@ -89,6 +89,7 @@ export default function InpaintingSettings() {
onClick={handleClearBrushHistory} onClick={handleClearBrushHistory}
tooltip="Clears brush stroke history" tooltip="Clears brush stroke history"
disabled={futureLines.length > 0 || pastLines.length > 0 ? false : true} disabled={futureLines.length > 0 || pastLines.length > 0 ? false : true}
styleClass="inpainting-options-btn"
/> />
</> </>
); );

View File

@ -39,6 +39,16 @@ export default function HotkeysModal({ children }: HotkeysModalProps) {
desc: 'Focus the prompt input area', desc: 'Focus the prompt input area',
hotkey: 'Alt+A', hotkey: 'Alt+A',
}, },
{
title: 'Toggle Options',
desc: 'Open and close the options panel',
hotkey: 'O',
},
{
title: 'Pin Options',
desc: 'Pin the options panel',
hotkey: 'Shift+O',
},
{ {
title: 'Toggle Gallery', title: 'Toggle Gallery',
desc: 'Open and close the gallery drawer', desc: 'Open and close the gallery drawer',
@ -101,7 +111,7 @@ export default function HotkeysModal({ children }: HotkeysModalProps) {
{ {
title: 'Toggle Gallery Pin', title: 'Toggle Gallery Pin',
desc: 'Pins and unpins the gallery to the UI', desc: 'Pins and unpins the gallery to the UI',
hotkey: 'Shift+P', hotkey: 'Shift+G',
}, },
{ {
title: 'Increase Gallery Image Size', title: 'Increase Gallery Image Size',

View File

@ -7,17 +7,16 @@
z-index: 20; z-index: 20;
padding: 0; padding: 0;
filter: var(--floating-button-drop-shadow);
svg {
fill: var(--tab-list-text);
}
&.left { &.left {
left: 0; left: 0;
border-radius: 0 0.5rem 0.5rem 0 !important; border-radius: 0 0.5rem 0.5rem 0 !important;
} }
&.btn-options {
left: 73px;
border-radius: 0 0.5rem 0.5rem 0 !important;
}
&.right { &.right {
right: 0; right: 0;
border-radius: 0.5rem 0 0 0.5rem !important; border-radius: 0.5rem 0 0 0.5rem !important;

View File

@ -83,6 +83,10 @@
} }
} }
.inpainting-options-btn {
min-height: 2rem;
}
// Overrides // Overrides
.inpainting-workarea-overrides { .inpainting-workarea-overrides {
.image-gallery-wrapper { .image-gallery-wrapper {

View File

@ -19,14 +19,13 @@
} }
.options-panel-wrapper { .options-panel-wrapper {
background-color: var(--background-color); grid-auto-rows: max-content;
height: $app-content-height; height: $app-content-height;
width: $options-bar-max-width; width: $options-bar-max-width;
max-width: $options-bar-max-width; max-width: $options-bar-max-width;
flex-shrink: 0; flex-shrink: 0;
position: relative; position: relative;
overflow-y: scroll; z-index: 20;
@include HideScrollbar;
.options-panel { .options-panel {
display: flex; display: flex;
@ -34,6 +33,8 @@
row-gap: 1rem; row-gap: 1rem;
height: 100%; height: 100%;
@include HideScrollbar; @include HideScrollbar;
background-color: var(--background-color) !important;
border-right: 1px solid var(--border-color);
} }
&[data-pinned='false'] { &[data-pinned='false'] {
@ -58,7 +59,7 @@
padding: 0.5rem; padding: 0.5rem;
top: 1rem; top: 1rem;
right: 1rem; right: 1rem;
z-index: 25; z-index: 20;
&[data-selected='true'] { &[data-selected='true'] {
top: 0; top: 0;

View File

@ -1,16 +1,11 @@
import { Tooltip } from '@chakra-ui/react'; import { Tooltip } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { import { MouseEvent, ReactNode, useCallback, useRef } from 'react';
FocusEvent, import { useHotkeys } from 'react-hotkeys-hook';
MouseEvent,
ReactNode,
useCallback,
useEffect,
useRef,
} from 'react';
import { BsPinAngle, BsPinAngleFill } from 'react-icons/bs'; import { BsPinAngle, BsPinAngleFill } from 'react-icons/bs';
import { CSSTransition } from 'react-transition-group'; import { CSSTransition } from 'react-transition-group';
import { RootState, useAppDispatch, useAppSelector } from '../../app/store'; import { RootState, useAppDispatch, useAppSelector } from '../../app/store';
import useClickOutsideWatcher from '../../common/hooks/useClickOutsideWatcher'; import useClickOutsideWatcher from '../../common/hooks/useClickOutsideWatcher';
import { import {
OptionsState, OptionsState,
@ -48,7 +43,6 @@ const InvokeOptionsPanel = (props: Props) => {
shouldShowOptionsPanel, shouldShowOptionsPanel,
shouldHoldOptionsPanelOpen, shouldHoldOptionsPanelOpen,
shouldPinOptionsPanel, shouldPinOptionsPanel,
optionsPanelScrollPosition,
} = useAppSelector(optionsPanelSelector); } = useAppSelector(optionsPanelSelector);
const optionsPanelRef = useRef<HTMLDivElement>(null); const optionsPanelRef = useRef<HTMLDivElement>(null);
@ -58,6 +52,24 @@ const InvokeOptionsPanel = (props: Props) => {
const { children } = props; const { children } = props;
// Hotkeys
useHotkeys(
'o',
() => {
dispatch(setShouldShowOptionsPanel(!shouldShowOptionsPanel));
},
[shouldShowOptionsPanel]
);
useHotkeys(
'shift+o',
() => {
handleClickPinOptionsPanel();
},
[shouldPinOptionsPanel]
);
//
const handleCloseOptionsPanel = useCallback(() => { const handleCloseOptionsPanel = useCallback(() => {
if (shouldPinOptionsPanel) return; if (shouldPinOptionsPanel) return;
dispatch( dispatch(

View File

@ -15,7 +15,7 @@ const ShowHideOptionsPanelButton = () => {
tooltip="Show Options Panel (G)" tooltip="Show Options Panel (G)"
tooltipPlacement="top" tooltipPlacement="top"
aria-label="Show Options Panel" aria-label="Show Options Panel"
styleClass="floating-show-hide-button left" styleClass="floating-show-hide-button btn-options"
onMouseOver={handleShowOptionsPanel} onMouseOver={handleShowOptionsPanel}
> >
<IoMdOptions /> <IoMdOptions />

View File

@ -1,6 +1,6 @@
// Calc Values // Calc Values
$app-cutoff: 0px; $app-cutoff: 0px;
$app-content-height-cutoff: calc(70px + 1rem); // default: 7rem $app-content-height-cutoff: 5rem; // default: 7rem
// Usage Variables // Usage Variables
// app // app