mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Readded Bounding Box Visibility Toggle
Only affects preview. The backend still takes the set bounding box.
This commit is contained in:
parent
ca882ad5ff
commit
3c55baf06b
@ -12,6 +12,16 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 0.5rem 1rem;
|
padding: 0.5rem 1rem;
|
||||||
border-radius: 0.4rem 0.4rem 0 0;
|
border-radius: 0.4rem 0.4rem 0 0;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
button {
|
||||||
|
width: 0.5rem !important;
|
||||||
|
height: 1.2rem !important;
|
||||||
|
background: none !important;
|
||||||
|
&:hover {
|
||||||
|
background: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Flex } from '@chakra-ui/react';
|
import { Flex } from '@chakra-ui/react';
|
||||||
import { createSelector } from '@reduxjs/toolkit';
|
import { createSelector } from '@reduxjs/toolkit';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { BiReset } from 'react-icons/bi';
|
|
||||||
|
import { BiHide, BiReset, BiShow } from 'react-icons/bi';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
RootState,
|
RootState,
|
||||||
@ -18,6 +19,7 @@ import {
|
|||||||
InpaintingState,
|
InpaintingState,
|
||||||
setBoundingBoxDimensions,
|
setBoundingBoxDimensions,
|
||||||
setShouldLockBoundingBox,
|
setShouldLockBoundingBox,
|
||||||
|
setShouldShowBoundingBox,
|
||||||
setShouldShowBoundingBoxFill,
|
setShouldShowBoundingBoxFill,
|
||||||
} from '../../../tabs/Inpainting/inpaintingSlice';
|
} from '../../../tabs/Inpainting/inpaintingSlice';
|
||||||
|
|
||||||
@ -27,6 +29,7 @@ const boundingBoxDimensionsSelector = createSelector(
|
|||||||
const {
|
const {
|
||||||
canvasDimensions,
|
canvasDimensions,
|
||||||
boundingBoxDimensions,
|
boundingBoxDimensions,
|
||||||
|
shouldShowBoundingBox,
|
||||||
shouldShowBoundingBoxFill,
|
shouldShowBoundingBoxFill,
|
||||||
pastLines,
|
pastLines,
|
||||||
futureLines,
|
futureLines,
|
||||||
@ -35,6 +38,7 @@ const boundingBoxDimensionsSelector = createSelector(
|
|||||||
return {
|
return {
|
||||||
canvasDimensions,
|
canvasDimensions,
|
||||||
boundingBoxDimensions,
|
boundingBoxDimensions,
|
||||||
|
shouldShowBoundingBox,
|
||||||
shouldShowBoundingBoxFill,
|
shouldShowBoundingBoxFill,
|
||||||
pastLines,
|
pastLines,
|
||||||
futureLines,
|
futureLines,
|
||||||
@ -53,6 +57,7 @@ const BoundingBoxSettings = () => {
|
|||||||
const {
|
const {
|
||||||
canvasDimensions,
|
canvasDimensions,
|
||||||
boundingBoxDimensions,
|
boundingBoxDimensions,
|
||||||
|
shouldShowBoundingBox,
|
||||||
shouldShowBoundingBoxFill,
|
shouldShowBoundingBoxFill,
|
||||||
shouldLockBoundingBox,
|
shouldLockBoundingBox,
|
||||||
} = useAppSelector(boundingBoxDimensionsSelector);
|
} = useAppSelector(boundingBoxDimensionsSelector);
|
||||||
@ -101,10 +106,22 @@ const BoundingBoxSettings = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleShowBoundingBox = () =>
|
||||||
|
dispatch(setShouldShowBoundingBox(!shouldShowBoundingBox));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="inpainting-bounding-box-settings">
|
<div className="inpainting-bounding-box-settings">
|
||||||
<div className="inpainting-bounding-box-header">
|
<div className="inpainting-bounding-box-header">
|
||||||
<p>Inpaint Box</p>
|
<p>Inpaint Box</p>
|
||||||
|
<IAIIconButton
|
||||||
|
aria-label="Toggle Bounding Box Visibility"
|
||||||
|
icon={
|
||||||
|
shouldShowBoundingBox ? <BiShow size={22} /> : <BiHide size={22} />
|
||||||
|
}
|
||||||
|
onClick={handleShowBoundingBox}
|
||||||
|
background={'none'}
|
||||||
|
padding={0}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="inpainting-bounding-box-settings-items">
|
<div className="inpainting-bounding-box-settings-items">
|
||||||
<div className="inpainting-bounding-box-dimensions-slider-numberinput">
|
<div className="inpainting-bounding-box-dimensions-slider-numberinput">
|
||||||
|
@ -53,6 +53,7 @@ const InpaintingCanvas = () => {
|
|||||||
maskColor,
|
maskColor,
|
||||||
imageToInpaint,
|
imageToInpaint,
|
||||||
stageScale,
|
stageScale,
|
||||||
|
shouldShowBoundingBox,
|
||||||
shouldShowBoundingBoxFill,
|
shouldShowBoundingBoxFill,
|
||||||
isDrawing,
|
isDrawing,
|
||||||
shouldLockBoundingBox,
|
shouldLockBoundingBox,
|
||||||
@ -300,10 +301,10 @@ const InpaintingCanvas = () => {
|
|||||||
)}
|
)}
|
||||||
</Layer>
|
</Layer>
|
||||||
<Layer>
|
<Layer>
|
||||||
{shouldShowBoundingBoxFill && (
|
{shouldShowBoundingBoxFill && shouldShowBoundingBox && (
|
||||||
<InpaintingBoundingBoxPreviewOverlay />
|
<InpaintingBoundingBoxPreviewOverlay />
|
||||||
)}
|
)}
|
||||||
<InpaintingBoundingBoxPreview />
|
{shouldShowBoundingBox && <InpaintingBoundingBoxPreview />}
|
||||||
{shouldLockBoundingBox && (
|
{shouldLockBoundingBox && (
|
||||||
<InpaintingCanvasBrushPreviewOutline />
|
<InpaintingCanvasBrushPreviewOutline />
|
||||||
)}
|
)}
|
||||||
|
@ -37,6 +37,7 @@ export interface InpaintingState {
|
|||||||
boundingBoxDimensions: Dimensions;
|
boundingBoxDimensions: Dimensions;
|
||||||
boundingBoxCoordinate: Vector2d;
|
boundingBoxCoordinate: Vector2d;
|
||||||
boundingBoxPreviewFill: RgbaColor;
|
boundingBoxPreviewFill: RgbaColor;
|
||||||
|
shouldShowBoundingBox: boolean;
|
||||||
shouldShowBoundingBoxFill: boolean;
|
shouldShowBoundingBoxFill: boolean;
|
||||||
lines: MaskLine[];
|
lines: MaskLine[];
|
||||||
pastLines: MaskLine[][];
|
pastLines: MaskLine[][];
|
||||||
@ -63,6 +64,7 @@ const initialInpaintingState: InpaintingState = {
|
|||||||
boundingBoxDimensions: { width: 512, height: 512 },
|
boundingBoxDimensions: { width: 512, height: 512 },
|
||||||
boundingBoxCoordinate: { x: 0, y: 0 },
|
boundingBoxCoordinate: { x: 0, y: 0 },
|
||||||
boundingBoxPreviewFill: { r: 0, g: 0, b: 0, a: 0.7 },
|
boundingBoxPreviewFill: { r: 0, g: 0, b: 0, a: 0.7 },
|
||||||
|
shouldShowBoundingBox: false,
|
||||||
shouldShowBoundingBoxFill: false,
|
shouldShowBoundingBoxFill: false,
|
||||||
cursorPosition: null,
|
cursorPosition: null,
|
||||||
lines: [],
|
lines: [],
|
||||||
@ -314,6 +316,9 @@ export const inpaintingSlice = createSlice({
|
|||||||
toggleShouldLockBoundingBox: (state) => {
|
toggleShouldLockBoundingBox: (state) => {
|
||||||
state.shouldLockBoundingBox = !state.shouldLockBoundingBox;
|
state.shouldLockBoundingBox = !state.shouldLockBoundingBox;
|
||||||
},
|
},
|
||||||
|
setShouldShowBoundingBox: (state, action: PayloadAction<boolean>) => {
|
||||||
|
state.shouldShowBoundingBox = action.payload;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -340,6 +345,7 @@ export const {
|
|||||||
setNeedsCache,
|
setNeedsCache,
|
||||||
setStageScale,
|
setStageScale,
|
||||||
toggleTool,
|
toggleTool,
|
||||||
|
setShouldShowBoundingBox,
|
||||||
setShouldShowBoundingBoxFill,
|
setShouldShowBoundingBoxFill,
|
||||||
setIsDrawing,
|
setIsDrawing,
|
||||||
setShouldShowBrush,
|
setShouldShowBrush,
|
||||||
|
@ -73,6 +73,7 @@ export const inpaintingCanvasSelector = createSelector(
|
|||||||
shouldShowCheckboardTransparency,
|
shouldShowCheckboardTransparency,
|
||||||
imageToInpaint,
|
imageToInpaint,
|
||||||
stageScale,
|
stageScale,
|
||||||
|
shouldShowBoundingBox,
|
||||||
shouldShowBoundingBoxFill,
|
shouldShowBoundingBoxFill,
|
||||||
isDrawing,
|
isDrawing,
|
||||||
shouldLockBoundingBox,
|
shouldLockBoundingBox,
|
||||||
@ -87,6 +88,7 @@ export const inpaintingCanvasSelector = createSelector(
|
|||||||
maskColor,
|
maskColor,
|
||||||
imageToInpaint,
|
imageToInpaint,
|
||||||
stageScale,
|
stageScale,
|
||||||
|
shouldShowBoundingBox,
|
||||||
shouldShowBoundingBoxFill,
|
shouldShowBoundingBoxFill,
|
||||||
isDrawing,
|
isDrawing,
|
||||||
shouldLockBoundingBox,
|
shouldLockBoundingBox,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user