mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Improves scaled bbox display logic
This commit is contained in:
parent
d4280bbaaa
commit
9568ac66e0
@ -23,14 +23,24 @@ const selector = createSelector(
|
|||||||
boundingBoxScaleMethod,
|
boundingBoxScaleMethod,
|
||||||
} = canvas;
|
} = canvas;
|
||||||
|
|
||||||
|
let boundingBoxColor = 'inherit';
|
||||||
|
|
||||||
|
if (
|
||||||
|
(boundingBoxScaleMethod === 'none' &&
|
||||||
|
(boxWidth < 512 || boxHeight < 512)) ||
|
||||||
|
(boundingBoxScaleMethod === 'manual' &&
|
||||||
|
scaledBoxWidth * scaledBoxHeight < 512 * 512)
|
||||||
|
) {
|
||||||
|
boundingBoxColor = 'var(--status-working-color)';
|
||||||
|
}
|
||||||
|
|
||||||
|
const activeLayerColor =
|
||||||
|
layer === 'mask' ? 'var(--status-working-color)' : 'inherit';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
activeLayerColor:
|
activeLayerColor,
|
||||||
layer === 'mask' ? 'var(--status-working-color)' : 'inherit',
|
|
||||||
activeLayerString: layer.charAt(0).toUpperCase() + layer.slice(1),
|
activeLayerString: layer.charAt(0).toUpperCase() + layer.slice(1),
|
||||||
boundingBoxColor:
|
boundingBoxColor,
|
||||||
boxWidth < 512 || boxHeight < 512
|
|
||||||
? 'var(--status-working-color)'
|
|
||||||
: 'inherit',
|
|
||||||
boundingBoxCoordinatesString: `(${roundToHundreth(
|
boundingBoxCoordinatesString: `(${roundToHundreth(
|
||||||
boxX
|
boxX
|
||||||
)}, ${roundToHundreth(boxY)})`,
|
)}, ${roundToHundreth(boxY)})`,
|
||||||
@ -42,6 +52,7 @@ const selector = createSelector(
|
|||||||
canvasDimensionsString: `${stageWidth}×${stageHeight}`,
|
canvasDimensionsString: `${stageWidth}×${stageHeight}`,
|
||||||
canvasScaleString: Math.round(stageScale * 100),
|
canvasScaleString: Math.round(stageScale * 100),
|
||||||
shouldShowCanvasDebugInfo,
|
shouldShowCanvasDebugInfo,
|
||||||
|
shouldShowBoundingBox: boundingBoxScaleMethod !== 'auto',
|
||||||
shouldShowScaledBoundingBox: boundingBoxScaleMethod !== 'none',
|
shouldShowScaledBoundingBox: boundingBoxScaleMethod !== 'none',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -65,6 +76,7 @@ const IAICanvasStatusText = () => {
|
|||||||
canvasDimensionsString,
|
canvasDimensionsString,
|
||||||
canvasScaleString,
|
canvasScaleString,
|
||||||
shouldShowCanvasDebugInfo,
|
shouldShowCanvasDebugInfo,
|
||||||
|
shouldShowBoundingBox,
|
||||||
} = useAppSelector(selector);
|
} = useAppSelector(selector);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -75,11 +87,13 @@ const IAICanvasStatusText = () => {
|
|||||||
}}
|
}}
|
||||||
>{`Active Layer: ${activeLayerString}`}</div>
|
>{`Active Layer: ${activeLayerString}`}</div>
|
||||||
<div>{`Canvas Scale: ${canvasScaleString}%`}</div>
|
<div>{`Canvas Scale: ${canvasScaleString}%`}</div>
|
||||||
<div
|
{shouldShowBoundingBox && (
|
||||||
style={{
|
<div
|
||||||
color: boundingBoxColor,
|
style={{
|
||||||
}}
|
color: boundingBoxColor,
|
||||||
>{`Bounding Box: ${boundingBoxDimensionsString}`}</div>
|
}}
|
||||||
|
>{`Bounding Box: ${boundingBoxDimensionsString}`}</div>
|
||||||
|
)}
|
||||||
{shouldShowScaledBoundingBox && (
|
{shouldShowScaledBoundingBox && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
Loading…
Reference in New Issue
Block a user