diff --git a/frontend/src/features/canvas/components/IAICanvasToolbar/IAICanvasMaskOptions.tsx b/frontend/src/features/canvas/components/IAICanvasToolbar/IAICanvasMaskOptions.tsx index b0090b4fb1..a06a032e0a 100644 --- a/frontend/src/features/canvas/components/IAICanvasToolbar/IAICanvasMaskOptions.tsx +++ b/frontend/src/features/canvas/components/IAICanvasToolbar/IAICanvasMaskOptions.tsx @@ -10,7 +10,7 @@ import { import { useAppDispatch, useAppSelector } from 'app/store'; import _ from 'lodash'; import IAIIconButton from 'common/components/IAIIconButton'; -import { FaMask } from 'react-icons/fa'; +import { FaMask, FaTrash } from 'react-icons/fa'; import IAIPopover from 'common/components/IAIPopover'; import IAICheckbox from 'common/components/IAICheckbox'; import IAIColorPicker from 'common/components/IAIColorPicker'; @@ -141,8 +141,12 @@ const IAICanvasMaskOptions = () => { color={maskColor} onChange={(newColor) => dispatch(setMaskColor(newColor))} /> - - Clear Mask + } + onClick={handleClearMask} + > + Clear Mask (Shift+C) diff --git a/frontend/src/features/canvas/components/IAICanvasToolbar/IAICanvasSettingsButtonPopover.tsx b/frontend/src/features/canvas/components/IAICanvasToolbar/IAICanvasSettingsButtonPopover.tsx index cf78acfe4e..998114da22 100644 --- a/frontend/src/features/canvas/components/IAICanvasToolbar/IAICanvasSettingsButtonPopover.tsx +++ b/frontend/src/features/canvas/components/IAICanvasToolbar/IAICanvasSettingsButtonPopover.tsx @@ -1,6 +1,7 @@ import { Flex } from '@chakra-ui/react'; import { createSelector } from '@reduxjs/toolkit'; import { + clearCanvasHistory, setShouldAutoSave, setShouldDarkenOutsideBoundingBox, setShouldShowCanvasDebugInfo, @@ -11,10 +12,11 @@ import { import { useAppDispatch, useAppSelector } from 'app/store'; import _ from 'lodash'; import IAIIconButton from 'common/components/IAIIconButton'; -import { FaWrench } from 'react-icons/fa'; +import { FaTrash, FaWrench } from 'react-icons/fa'; import IAIPopover from 'common/components/IAIPopover'; import IAICheckbox from 'common/components/IAICheckbox'; import { canvasSelector } from 'features/canvas/store/canvasSelectors'; +import IAIButton from 'common/components/IAIButton'; export const canvasControlsSelector = createSelector( [canvasSelector], @@ -103,6 +105,13 @@ const IAICanvasSettingsButtonPopover = () => { dispatch(setShouldShowCanvasDebugInfo(e.target.checked)) } /> + } + onClick={() => dispatch(clearCanvasHistory())} + > + Clear Canvas History + ); diff --git a/frontend/src/features/canvas/store/canvasSlice.ts b/frontend/src/features/canvas/store/canvasSlice.ts index 56925db57f..879539265e 100644 --- a/frontend/src/features/canvas/store/canvasSlice.ts +++ b/frontend/src/features/canvas/store/canvasSlice.ts @@ -264,7 +264,7 @@ export const canvasSlice = createSlice({ setIsDrawing: (state, action: PayloadAction) => { state.isDrawing = action.payload; }, - setClearBrushHistory: (state) => { + clearCanvasHistory: (state) => { state.pastLayerStates = []; state.futureLayerStates = []; }, @@ -712,7 +712,7 @@ export const { setBrushColor, setBrushSize, setCanvasContainerDimensions, - setClearBrushHistory, + clearCanvasHistory, setCursorPosition, setDoesCanvasNeedScaling, setInitialCanvasImage,