Skip to content

Commit 46b91a0

Browse files
lints
1 parent 953b9c7 commit 46b91a0

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

invokeai/frontend/web/src/features/controlLayers/components/InpaintMask/InpaintMaskBboxAdjuster.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const InpaintMaskBboxAdjuster = memo(() => {
2323
const canvasSlice = useAppSelector(selectCanvasSlice);
2424
const maskBlur = useAppSelector(selectMaskBlur);
2525

26-
// Get all inpaint mask entities and bbox
2726
const inpaintMasks = canvasSlice.inpaintMasks.entities;
2827
const bboxRect = canvasSlice.bbox.rect;
2928

@@ -33,11 +32,9 @@ export const InpaintMaskBboxAdjuster = memo(() => {
3332
return null;
3433
}
3534

36-
// Use the current bbox as the reference container
3735
const canvasWidth = bboxRect.width;
3836
const canvasHeight = bboxRect.height;
3937

40-
// Collect all mask objects and adjust their positions relative to the bbox
4138
const allObjects: (
4239
| CanvasBrushLineState
4340
| CanvasBrushLineWithPressureState
@@ -51,7 +48,6 @@ export const InpaintMaskBboxAdjuster = memo(() => {
5148
continue;
5249
}
5350

54-
// Adjust object positions relative to the bbox (not the entity position)
5551
for (const obj of mask.objects) {
5652
if (obj.type === 'rect') {
5753
const adjustedObj = {
@@ -81,7 +77,6 @@ export const InpaintMaskBboxAdjuster = memo(() => {
8177
allObjects.push(adjustedObj);
8278
} else if (obj.type === 'image') {
8379
// For image objects, we need to handle them differently since they don't have rect or points
84-
// We'll skip them for now as they're not commonly used in masks
8580
continue;
8681
}
8782
}
@@ -95,7 +90,6 @@ export const InpaintMaskBboxAdjuster = memo(() => {
9590
const bitmap = maskObjectsToBitmap(allObjects, canvasWidth, canvasHeight);
9691
const { width, height, data } = bitmap;
9792

98-
// Find the actual bounds of the rendered mask
9993
let maskMinX = width;
10094
let maskMinY = height;
10195
let maskMaxX = 0;
@@ -106,7 +100,6 @@ export const InpaintMaskBboxAdjuster = memo(() => {
106100
const pixelIndex = (y * width + x) * 4;
107101
const alpha = data[pixelIndex + 3] ?? 0;
108102

109-
// If this pixel has any opacity, it's part of the mask
110103
if (alpha > 0) {
111104
maskMinX = Math.min(maskMinX, x);
112105
maskMinY = Math.min(maskMinY, y);
@@ -116,18 +109,15 @@ export const InpaintMaskBboxAdjuster = memo(() => {
116109
}
117110
}
118111

119-
// If no mask pixels found, return null
120112
if (maskMinX >= maskMaxX || maskMinY >= maskMaxY) {
121113
return null;
122114
}
123115

124-
// Clamp the mask bounds to the bbox boundaries
125116
maskMinX = Math.max(0, maskMinX);
126117
maskMinY = Math.max(0, maskMinY);
127118
maskMaxX = Math.min(width - 1, maskMaxX);
128119
maskMaxY = Math.min(height - 1, maskMaxY);
129120

130-
// Convert back to world coordinates relative to the bbox
131121
return {
132122
x: bboxRect.x + maskMinX,
133123
y: bboxRect.y + maskMinY,
@@ -155,7 +145,6 @@ export const InpaintMaskBboxAdjuster = memo(() => {
155145
dispatch(bboxChangedFromCanvas(adjustedBbox));
156146
}, [dispatch, maskBbox, maskBlur]);
157147

158-
// Only show if there are enabled inpaint masks with objects
159148
const hasValidMasks = inpaintMasks.some((mask) => mask.isEnabled && mask.objects.length > 0);
160149
if (!hasValidMasks) {
161150
return null;

0 commit comments

Comments
 (0)