mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix: Concat Link Styling (#4048)
## What type of PR is this? (check all applicable) - [x] Bug Fix ## Description - Fix SDXL Concat Link animation not considering the fact that prompt boxes can be resized. - Also fixed a minor issue where the overlaying animation box would block the prompt input resize slightly. Should be good now.
This commit is contained in:
commit
f8181ab1b3
@ -13,15 +13,20 @@ import { useIsReadyToInvoke } from 'common/hooks/useIsReadyToInvoke';
|
|||||||
import AddEmbeddingButton from 'features/embedding/components/AddEmbeddingButton';
|
import AddEmbeddingButton from 'features/embedding/components/AddEmbeddingButton';
|
||||||
import ParamEmbeddingPopover from 'features/embedding/components/ParamEmbeddingPopover';
|
import ParamEmbeddingPopover from 'features/embedding/components/ParamEmbeddingPopover';
|
||||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||||
|
import { AnimatePresence } from 'framer-motion';
|
||||||
import { isEqual } from 'lodash-es';
|
import { isEqual } from 'lodash-es';
|
||||||
import { flushSync } from 'react-dom';
|
import { flushSync } from 'react-dom';
|
||||||
import { setNegativeStylePromptSDXL } from '../store/sdxlSlice';
|
import { setNegativeStylePromptSDXL } from '../store/sdxlSlice';
|
||||||
|
import SDXLConcatLink from './SDXLConcatLink';
|
||||||
|
|
||||||
const promptInputSelector = createSelector(
|
const promptInputSelector = createSelector(
|
||||||
[stateSelector, activeTabNameSelector],
|
[stateSelector, activeTabNameSelector],
|
||||||
({ sdxl }, activeTabName) => {
|
({ sdxl }, activeTabName) => {
|
||||||
|
const { negativeStylePrompt, shouldConcatSDXLStylePrompt } = sdxl;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
prompt: sdxl.negativeStylePrompt,
|
prompt: negativeStylePrompt,
|
||||||
|
shouldConcatSDXLStylePrompt,
|
||||||
activeTabName,
|
activeTabName,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -37,11 +42,13 @@ const promptInputSelector = createSelector(
|
|||||||
*/
|
*/
|
||||||
const ParamSDXLNegativeStyleConditioning = () => {
|
const ParamSDXLNegativeStyleConditioning = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { prompt, activeTabName } = useAppSelector(promptInputSelector);
|
|
||||||
const isReady = useIsReadyToInvoke();
|
const isReady = useIsReadyToInvoke();
|
||||||
const promptRef = useRef<HTMLTextAreaElement>(null);
|
const promptRef = useRef<HTMLTextAreaElement>(null);
|
||||||
const { isOpen, onClose, onOpen } = useDisclosure();
|
const { isOpen, onClose, onOpen } = useDisclosure();
|
||||||
|
|
||||||
|
const { prompt, activeTabName, shouldConcatSDXLStylePrompt } =
|
||||||
|
useAppSelector(promptInputSelector);
|
||||||
|
|
||||||
const handleChangePrompt = useCallback(
|
const handleChangePrompt = useCallback(
|
||||||
(e: ChangeEvent<HTMLTextAreaElement>) => {
|
(e: ChangeEvent<HTMLTextAreaElement>) => {
|
||||||
dispatch(setNegativeStylePromptSDXL(e.target.value));
|
dispatch(setNegativeStylePromptSDXL(e.target.value));
|
||||||
@ -111,6 +118,20 @@ const ParamSDXLNegativeStyleConditioning = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box position="relative">
|
<Box position="relative">
|
||||||
|
<AnimatePresence>
|
||||||
|
{shouldConcatSDXLStylePrompt && (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
position: 'absolute',
|
||||||
|
left: '3',
|
||||||
|
w: '94%',
|
||||||
|
top: '-17px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SDXLConcatLink />
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<ParamEmbeddingPopover
|
<ParamEmbeddingPopover
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
|
@ -13,15 +13,20 @@ import { useIsReadyToInvoke } from 'common/hooks/useIsReadyToInvoke';
|
|||||||
import AddEmbeddingButton from 'features/embedding/components/AddEmbeddingButton';
|
import AddEmbeddingButton from 'features/embedding/components/AddEmbeddingButton';
|
||||||
import ParamEmbeddingPopover from 'features/embedding/components/ParamEmbeddingPopover';
|
import ParamEmbeddingPopover from 'features/embedding/components/ParamEmbeddingPopover';
|
||||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||||
|
import { AnimatePresence } from 'framer-motion';
|
||||||
import { isEqual } from 'lodash-es';
|
import { isEqual } from 'lodash-es';
|
||||||
import { flushSync } from 'react-dom';
|
import { flushSync } from 'react-dom';
|
||||||
import { setPositiveStylePromptSDXL } from '../store/sdxlSlice';
|
import { setPositiveStylePromptSDXL } from '../store/sdxlSlice';
|
||||||
|
import SDXLConcatLink from './SDXLConcatLink';
|
||||||
|
|
||||||
const promptInputSelector = createSelector(
|
const promptInputSelector = createSelector(
|
||||||
[stateSelector, activeTabNameSelector],
|
[stateSelector, activeTabNameSelector],
|
||||||
({ sdxl }, activeTabName) => {
|
({ sdxl }, activeTabName) => {
|
||||||
|
const { positiveStylePrompt, shouldConcatSDXLStylePrompt } = sdxl;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
prompt: sdxl.positiveStylePrompt,
|
prompt: positiveStylePrompt,
|
||||||
|
shouldConcatSDXLStylePrompt,
|
||||||
activeTabName,
|
activeTabName,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -37,11 +42,13 @@ const promptInputSelector = createSelector(
|
|||||||
*/
|
*/
|
||||||
const ParamSDXLPositiveStyleConditioning = () => {
|
const ParamSDXLPositiveStyleConditioning = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { prompt, activeTabName } = useAppSelector(promptInputSelector);
|
|
||||||
const isReady = useIsReadyToInvoke();
|
const isReady = useIsReadyToInvoke();
|
||||||
const promptRef = useRef<HTMLTextAreaElement>(null);
|
const promptRef = useRef<HTMLTextAreaElement>(null);
|
||||||
const { isOpen, onClose, onOpen } = useDisclosure();
|
const { isOpen, onClose, onOpen } = useDisclosure();
|
||||||
|
|
||||||
|
const { prompt, activeTabName, shouldConcatSDXLStylePrompt } =
|
||||||
|
useAppSelector(promptInputSelector);
|
||||||
|
|
||||||
const handleChangePrompt = useCallback(
|
const handleChangePrompt = useCallback(
|
||||||
(e: ChangeEvent<HTMLTextAreaElement>) => {
|
(e: ChangeEvent<HTMLTextAreaElement>) => {
|
||||||
dispatch(setPositiveStylePromptSDXL(e.target.value));
|
dispatch(setPositiveStylePromptSDXL(e.target.value));
|
||||||
@ -111,6 +118,20 @@ const ParamSDXLPositiveStyleConditioning = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box position="relative">
|
<Box position="relative">
|
||||||
|
<AnimatePresence>
|
||||||
|
{shouldConcatSDXLStylePrompt && (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
position: 'absolute',
|
||||||
|
left: '3',
|
||||||
|
w: '94%',
|
||||||
|
top: '-17px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SDXLConcatLink />
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<ParamEmbeddingPopover
|
<ParamEmbeddingPopover
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
|
@ -1,23 +1,11 @@
|
|||||||
import { Box, Flex } from '@chakra-ui/react';
|
import { Flex } from '@chakra-ui/react';
|
||||||
import { RootState } from 'app/store/store';
|
|
||||||
import { useAppSelector } from 'app/store/storeHooks';
|
|
||||||
import ParamNegativeConditioning from 'features/parameters/components/Parameters/Core/ParamNegativeConditioning';
|
import ParamNegativeConditioning from 'features/parameters/components/Parameters/Core/ParamNegativeConditioning';
|
||||||
import ParamPositiveConditioning from 'features/parameters/components/Parameters/Core/ParamPositiveConditioning';
|
import ParamPositiveConditioning from 'features/parameters/components/Parameters/Core/ParamPositiveConditioning';
|
||||||
import { AnimatePresence } from 'framer-motion';
|
|
||||||
import ParamSDXLConcatButton from './ParamSDXLConcatButton';
|
import ParamSDXLConcatButton from './ParamSDXLConcatButton';
|
||||||
import ParamSDXLNegativeStyleConditioning from './ParamSDXLNegativeStyleConditioning';
|
import ParamSDXLNegativeStyleConditioning from './ParamSDXLNegativeStyleConditioning';
|
||||||
import ParamSDXLPositiveStyleConditioning from './ParamSDXLPositiveStyleConditioning';
|
import ParamSDXLPositiveStyleConditioning from './ParamSDXLPositiveStyleConditioning';
|
||||||
import SDXLConcatLink from './SDXLConcatLink';
|
|
||||||
|
|
||||||
export default function ParamSDXLPromptArea() {
|
export default function ParamSDXLPromptArea() {
|
||||||
const shouldPinParametersPanel = useAppSelector(
|
|
||||||
(state: RootState) => state.ui.shouldPinParametersPanel
|
|
||||||
);
|
|
||||||
|
|
||||||
const shouldConcatSDXLStylePrompt = useAppSelector(
|
|
||||||
(state: RootState) => state.sdxl.shouldConcatSDXLStylePrompt
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
sx={{
|
sx={{
|
||||||
@ -25,32 +13,6 @@ export default function ParamSDXLPromptArea() {
|
|||||||
gap: 2,
|
gap: 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<AnimatePresence>
|
|
||||||
{shouldConcatSDXLStylePrompt && (
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
position: 'absolute',
|
|
||||||
w: 'full',
|
|
||||||
top: shouldPinParametersPanel ? '119px' : '175px',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<SDXLConcatLink />
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</AnimatePresence>
|
|
||||||
<AnimatePresence>
|
|
||||||
{shouldConcatSDXLStylePrompt && (
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
position: 'absolute',
|
|
||||||
w: 'full',
|
|
||||||
top: shouldPinParametersPanel ? '263px' : '319px',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<SDXLConcatLink />
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</AnimatePresence>
|
|
||||||
<ParamPositiveConditioning />
|
<ParamPositiveConditioning />
|
||||||
<ParamSDXLConcatButton />
|
<ParamSDXLConcatButton />
|
||||||
<ParamSDXLPositiveStyleConditioning />
|
<ParamSDXLPositiveStyleConditioning />
|
||||||
|
@ -18,14 +18,7 @@ const sharedConcatLinkStyle: CSSObject = {
|
|||||||
|
|
||||||
export default function SDXLConcatLink() {
|
export default function SDXLConcatLink() {
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex>
|
||||||
sx={{
|
|
||||||
h: 0.5,
|
|
||||||
placeContent: 'center',
|
|
||||||
gap: 2,
|
|
||||||
flexDirection: 'column',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box
|
<Box
|
||||||
as={motion.div}
|
as={motion.div}
|
||||||
initial={{
|
initial={{
|
||||||
@ -43,7 +36,6 @@ export default function SDXLConcatLink() {
|
|||||||
top: '1px',
|
top: '1px',
|
||||||
borderTop: 'none',
|
borderTop: 'none',
|
||||||
borderColor: 'base.400',
|
borderColor: 'base.400',
|
||||||
zIndex: 2,
|
|
||||||
...sharedConcatLinkStyle,
|
...sharedConcatLinkStyle,
|
||||||
_dark: {
|
_dark: {
|
||||||
borderColor: 'accent.500',
|
borderColor: 'accent.500',
|
||||||
|
Loading…
Reference in New Issue
Block a user