From 3c55baf06b66ac3e9b5aa5a2a3ecb95fa28f85ea Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Mon, 31 Oct 2022 08:16:26 +1300 Subject: [PATCH] Readded Bounding Box Visibility Toggle Only affects preview. The backend still takes the set bounding box. --- .../Inpainting/BoundingBoxSettings.scss | 10 ++++++++++ .../Inpainting/BoundingBoxSettings.tsx | 19 ++++++++++++++++++- .../tabs/Inpainting/InpaintingCanvas.tsx | 5 +++-- .../tabs/Inpainting/inpaintingSlice.ts | 6 ++++++ .../Inpainting/inpaintingSliceSelectors.ts | 2 ++ 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/frontend/src/features/options/AdvancedOptions/Inpainting/BoundingBoxSettings.scss b/frontend/src/features/options/AdvancedOptions/Inpainting/BoundingBoxSettings.scss index 3233c4a591..5eef7cc47d 100644 --- a/frontend/src/features/options/AdvancedOptions/Inpainting/BoundingBoxSettings.scss +++ b/frontend/src/features/options/AdvancedOptions/Inpainting/BoundingBoxSettings.scss @@ -12,6 +12,16 @@ justify-content: space-between; padding: 0.5rem 1rem; 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 { font-weight: bold; diff --git a/frontend/src/features/options/AdvancedOptions/Inpainting/BoundingBoxSettings.tsx b/frontend/src/features/options/AdvancedOptions/Inpainting/BoundingBoxSettings.tsx index 5ab30ba6ca..a76ddb988a 100644 --- a/frontend/src/features/options/AdvancedOptions/Inpainting/BoundingBoxSettings.tsx +++ b/frontend/src/features/options/AdvancedOptions/Inpainting/BoundingBoxSettings.tsx @@ -1,7 +1,8 @@ import { Flex } from '@chakra-ui/react'; import { createSelector } from '@reduxjs/toolkit'; import _ from 'lodash'; -import { BiReset } from 'react-icons/bi'; + +import { BiHide, BiReset, BiShow } from 'react-icons/bi'; import { RootState, @@ -18,6 +19,7 @@ import { InpaintingState, setBoundingBoxDimensions, setShouldLockBoundingBox, + setShouldShowBoundingBox, setShouldShowBoundingBoxFill, } from '../../../tabs/Inpainting/inpaintingSlice'; @@ -27,6 +29,7 @@ const boundingBoxDimensionsSelector = createSelector( const { canvasDimensions, boundingBoxDimensions, + shouldShowBoundingBox, shouldShowBoundingBoxFill, pastLines, futureLines, @@ -35,6 +38,7 @@ const boundingBoxDimensionsSelector = createSelector( return { canvasDimensions, boundingBoxDimensions, + shouldShowBoundingBox, shouldShowBoundingBoxFill, pastLines, futureLines, @@ -53,6 +57,7 @@ const BoundingBoxSettings = () => { const { canvasDimensions, boundingBoxDimensions, + shouldShowBoundingBox, shouldShowBoundingBoxFill, shouldLockBoundingBox, } = useAppSelector(boundingBoxDimensionsSelector); @@ -101,10 +106,22 @@ const BoundingBoxSettings = () => { ); }; + const handleShowBoundingBox = () => + dispatch(setShouldShowBoundingBox(!shouldShowBoundingBox)); + return (
Inpaint Box
+