mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Improves canvas status text and adds option to toggle debug info
This commit is contained in:
parent
cccbfb12aa
commit
37a356d377
@ -17,6 +17,8 @@ const selector = createSelector(
|
|||||||
boundingBoxCoordinates: { x: boxX, y: boxY },
|
boundingBoxCoordinates: { x: boxX, y: boxY },
|
||||||
cursorPosition,
|
cursorPosition,
|
||||||
stageScale,
|
stageScale,
|
||||||
|
shouldShowCanvasDebugInfo,
|
||||||
|
layer,
|
||||||
} = canvas;
|
} = canvas;
|
||||||
|
|
||||||
const position = cursorPosition
|
const position = cursorPosition
|
||||||
@ -33,6 +35,9 @@ const selector = createSelector(
|
|||||||
boxX,
|
boxX,
|
||||||
boxY,
|
boxY,
|
||||||
stageScale,
|
stageScale,
|
||||||
|
shouldShowCanvasDebugInfo,
|
||||||
|
layerFormatted: layer.charAt(0).toUpperCase() + layer.slice(1),
|
||||||
|
layer,
|
||||||
...position,
|
...position,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -56,17 +61,37 @@ const IAICanvasStatusText = () => {
|
|||||||
cursorX,
|
cursorX,
|
||||||
cursorY,
|
cursorY,
|
||||||
stageScale,
|
stageScale,
|
||||||
|
shouldShowCanvasDebugInfo,
|
||||||
|
layer,
|
||||||
|
layerFormatted,
|
||||||
} = useAppSelector(selector);
|
} = useAppSelector(selector);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="canvas-status-text">
|
<div className="canvas-status-text">
|
||||||
<div>{`Stage: ${stageWidth} x ${stageHeight}`}</div>
|
<div
|
||||||
<div>{`Stage: ${roundToHundreth(stageX)}, ${roundToHundreth(
|
style={{
|
||||||
stageY
|
color: layer === 'mask' ? 'var(--status-working-color)' : 'inherit',
|
||||||
)}`}</div>
|
}}
|
||||||
<div>{`Scale: ${roundToHundreth(stageScale)}`}</div>
|
>{`Active Layer: ${layerFormatted}`}</div>
|
||||||
<div>{`Box: ${boxWidth} x ${boxHeight}`}</div>
|
<div>{`Canvas Scale: ${Math.round(stageScale * 100)}%`}</div>
|
||||||
<div>{`Box: ${roundToHundreth(boxX)}, ${roundToHundreth(boxY)}`}</div>
|
<div
|
||||||
<div>{`Cursor: ${cursorX}, ${cursorY}`}</div>
|
style={{
|
||||||
|
color:
|
||||||
|
boxWidth < 512 || boxHeight < 512
|
||||||
|
? 'var(--status-working-color)'
|
||||||
|
: 'inherit',
|
||||||
|
}}
|
||||||
|
>{`Bounding Box: ${boxWidth}×${boxHeight}`}</div>
|
||||||
|
{shouldShowCanvasDebugInfo && (
|
||||||
|
<>
|
||||||
|
<div>{`Bounding Box Position: (${roundToHundreth(
|
||||||
|
boxX
|
||||||
|
)}, ${roundToHundreth(boxY)})`}</div>
|
||||||
|
<div>{`Canvas Dimensions: ${stageWidth}×${stageHeight}`}</div>
|
||||||
|
<div>{`Canvas Position: ${stageX}×${stageY}`}</div>
|
||||||
|
<div>{`Cursor Position: (${cursorX}, ${cursorY})`}</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,7 @@ import { createSelector } from '@reduxjs/toolkit';
|
|||||||
import {
|
import {
|
||||||
setShouldAutoSave,
|
setShouldAutoSave,
|
||||||
setShouldDarkenOutsideBoundingBox,
|
setShouldDarkenOutsideBoundingBox,
|
||||||
|
setShouldShowCanvasDebugInfo,
|
||||||
setShouldShowGrid,
|
setShouldShowGrid,
|
||||||
setShouldShowIntermediates,
|
setShouldShowIntermediates,
|
||||||
setShouldSnapToGrid,
|
setShouldSnapToGrid,
|
||||||
@ -24,6 +25,7 @@ export const canvasControlsSelector = createSelector(
|
|||||||
shouldShowGrid,
|
shouldShowGrid,
|
||||||
shouldSnapToGrid,
|
shouldSnapToGrid,
|
||||||
shouldAutoSave,
|
shouldAutoSave,
|
||||||
|
shouldShowCanvasDebugInfo,
|
||||||
} = canvas;
|
} = canvas;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -32,6 +34,7 @@ export const canvasControlsSelector = createSelector(
|
|||||||
shouldAutoSave,
|
shouldAutoSave,
|
||||||
shouldDarkenOutsideBoundingBox,
|
shouldDarkenOutsideBoundingBox,
|
||||||
shouldShowIntermediates,
|
shouldShowIntermediates,
|
||||||
|
shouldShowCanvasDebugInfo,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -49,6 +52,7 @@ const IAICanvasSettingsButtonPopover = () => {
|
|||||||
shouldSnapToGrid,
|
shouldSnapToGrid,
|
||||||
shouldAutoSave,
|
shouldAutoSave,
|
||||||
shouldDarkenOutsideBoundingBox,
|
shouldDarkenOutsideBoundingBox,
|
||||||
|
shouldShowCanvasDebugInfo,
|
||||||
} = useAppSelector(canvasControlsSelector);
|
} = useAppSelector(canvasControlsSelector);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -94,6 +98,13 @@ const IAICanvasSettingsButtonPopover = () => {
|
|||||||
isChecked={shouldAutoSave}
|
isChecked={shouldAutoSave}
|
||||||
onChange={(e) => dispatch(setShouldAutoSave(e.target.checked))}
|
onChange={(e) => dispatch(setShouldAutoSave(e.target.checked))}
|
||||||
/>
|
/>
|
||||||
|
<IAICheckbox
|
||||||
|
label="Show Canvas Debug Info"
|
||||||
|
isChecked={shouldShowCanvasDebugInfo}
|
||||||
|
onChange={(e) =>
|
||||||
|
dispatch(setShouldShowCanvasDebugInfo(e.target.checked))
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
</IAIPopover>
|
</IAIPopover>
|
||||||
);
|
);
|
||||||
|
@ -70,6 +70,7 @@ const initialCanvasState: CanvasState = {
|
|||||||
shouldShowBoundingBox: true,
|
shouldShowBoundingBox: true,
|
||||||
shouldShowBrush: true,
|
shouldShowBrush: true,
|
||||||
shouldShowBrushPreview: false,
|
shouldShowBrushPreview: false,
|
||||||
|
shouldShowCanvasDebugInfo: false,
|
||||||
shouldShowCheckboardTransparency: false,
|
shouldShowCheckboardTransparency: false,
|
||||||
shouldShowGrid: true,
|
shouldShowGrid: true,
|
||||||
shouldShowIntermediates: true,
|
shouldShowIntermediates: true,
|
||||||
@ -640,6 +641,9 @@ export const canvasSlice = createSlice({
|
|||||||
setShouldShowStagingOutline: (state, action: PayloadAction<boolean>) => {
|
setShouldShowStagingOutline: (state, action: PayloadAction<boolean>) => {
|
||||||
state.shouldShowStagingOutline = action.payload;
|
state.shouldShowStagingOutline = action.payload;
|
||||||
},
|
},
|
||||||
|
setShouldShowCanvasDebugInfo: (state, action: PayloadAction<boolean>) => {
|
||||||
|
state.shouldShowCanvasDebugInfo = action.payload;
|
||||||
|
},
|
||||||
setMergedCanvas: (state, action: PayloadAction<CanvasImage>) => {
|
setMergedCanvas: (state, action: PayloadAction<CanvasImage>) => {
|
||||||
state.pastLayerStates.push({
|
state.pastLayerStates.push({
|
||||||
...state.layerState,
|
...state.layerState,
|
||||||
@ -653,63 +657,64 @@ export const canvasSlice = createSlice({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const {
|
export const {
|
||||||
setTool,
|
addImageToStagingArea,
|
||||||
setLayer,
|
|
||||||
setBrushColor,
|
|
||||||
setBrushSize,
|
|
||||||
addLine,
|
addLine,
|
||||||
addPointToCurrentLine,
|
addPointToCurrentLine,
|
||||||
setShouldPreserveMaskedArea,
|
|
||||||
setIsMaskEnabled,
|
|
||||||
setShouldShowCheckboardTransparency,
|
|
||||||
setShouldShowBrushPreview,
|
|
||||||
setMaskColor,
|
|
||||||
clearMask,
|
clearMask,
|
||||||
undo,
|
commitStagingAreaImage,
|
||||||
|
discardStagedImages,
|
||||||
|
fitBoundingBoxToStage,
|
||||||
|
nextStagingAreaImage,
|
||||||
|
prevStagingAreaImage,
|
||||||
redo,
|
redo,
|
||||||
setCursorPosition,
|
resetCanvas,
|
||||||
setStageDimensions,
|
resetCanvasView,
|
||||||
setInitialCanvasImage,
|
resizeAndScaleCanvas,
|
||||||
setBoundingBoxDimensions,
|
resizeCanvas,
|
||||||
setBoundingBoxCoordinates,
|
setBoundingBoxCoordinates,
|
||||||
|
setBoundingBoxDimensions,
|
||||||
setBoundingBoxPreviewFill,
|
setBoundingBoxPreviewFill,
|
||||||
setDoesCanvasNeedScaling,
|
setBrushColor,
|
||||||
setStageScale,
|
setBrushSize,
|
||||||
toggleTool,
|
setCanvasContainerDimensions,
|
||||||
setShouldShowBoundingBox,
|
|
||||||
setShouldDarkenOutsideBoundingBox,
|
|
||||||
setIsDrawing,
|
|
||||||
setShouldShowBrush,
|
|
||||||
setClearBrushHistory,
|
setClearBrushHistory,
|
||||||
setShouldUseInpaintReplace,
|
setCursorPosition,
|
||||||
|
setDoesCanvasNeedScaling,
|
||||||
|
setInitialCanvasImage,
|
||||||
setInpaintReplace,
|
setInpaintReplace,
|
||||||
setShouldLockBoundingBox,
|
setIsDrawing,
|
||||||
toggleShouldLockBoundingBox,
|
setIsMaskEnabled,
|
||||||
setIsMovingBoundingBox,
|
|
||||||
setIsTransformingBoundingBox,
|
|
||||||
setIsMouseOverBoundingBox,
|
setIsMouseOverBoundingBox,
|
||||||
setIsMoveBoundingBoxKeyHeld,
|
setIsMoveBoundingBoxKeyHeld,
|
||||||
setIsMoveStageKeyHeld,
|
setIsMoveStageKeyHeld,
|
||||||
setStageCoordinates,
|
setIsMovingBoundingBox,
|
||||||
addImageToStagingArea,
|
|
||||||
resetCanvas,
|
|
||||||
setShouldShowGrid,
|
|
||||||
setShouldSnapToGrid,
|
|
||||||
setShouldAutoSave,
|
|
||||||
setShouldShowIntermediates,
|
|
||||||
setIsMovingStage,
|
setIsMovingStage,
|
||||||
nextStagingAreaImage,
|
setIsTransformingBoundingBox,
|
||||||
prevStagingAreaImage,
|
setLayer,
|
||||||
commitStagingAreaImage,
|
setMaskColor,
|
||||||
discardStagedImages,
|
|
||||||
resizeAndScaleCanvas,
|
|
||||||
resizeCanvas,
|
|
||||||
resetCanvasView,
|
|
||||||
setCanvasContainerDimensions,
|
|
||||||
fitBoundingBoxToStage,
|
|
||||||
setShouldShowStagingImage,
|
|
||||||
setMergedCanvas,
|
setMergedCanvas,
|
||||||
|
setShouldAutoSave,
|
||||||
|
setShouldDarkenOutsideBoundingBox,
|
||||||
|
setShouldLockBoundingBox,
|
||||||
|
setShouldPreserveMaskedArea,
|
||||||
|
setShouldShowBoundingBox,
|
||||||
|
setShouldShowBrush,
|
||||||
|
setShouldShowBrushPreview,
|
||||||
|
setShouldShowCanvasDebugInfo,
|
||||||
|
setShouldShowCheckboardTransparency,
|
||||||
|
setShouldShowGrid,
|
||||||
|
setShouldShowIntermediates,
|
||||||
|
setShouldShowStagingImage,
|
||||||
setShouldShowStagingOutline,
|
setShouldShowStagingOutline,
|
||||||
|
setShouldSnapToGrid,
|
||||||
|
setShouldUseInpaintReplace,
|
||||||
|
setStageCoordinates,
|
||||||
|
setStageDimensions,
|
||||||
|
setStageScale,
|
||||||
|
setTool,
|
||||||
|
toggleShouldLockBoundingBox,
|
||||||
|
toggleTool,
|
||||||
|
undo,
|
||||||
} = canvasSlice.actions;
|
} = canvasSlice.actions;
|
||||||
|
|
||||||
export default canvasSlice.reducer;
|
export default canvasSlice.reducer;
|
||||||
|
@ -101,6 +101,7 @@ export interface CanvasState {
|
|||||||
shouldShowBoundingBox: boolean;
|
shouldShowBoundingBox: boolean;
|
||||||
shouldShowBrush: boolean;
|
shouldShowBrush: boolean;
|
||||||
shouldShowBrushPreview: boolean;
|
shouldShowBrushPreview: boolean;
|
||||||
|
shouldShowCanvasDebugInfo: boolean;
|
||||||
shouldShowCheckboardTransparency: boolean;
|
shouldShowCheckboardTransparency: boolean;
|
||||||
shouldShowGrid: boolean;
|
shouldShowGrid: boolean;
|
||||||
shouldShowIntermediates: boolean;
|
shouldShowIntermediates: boolean;
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
padding: 0.25rem;
|
padding: 0.25rem;
|
||||||
width: 12rem;
|
min-width: 12rem;
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
margin: 0.25rem;
|
margin: 0.25rem;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user