fix(ui): set buffered rect color to full alpha

This commit is contained in:
psychedelicious 2024-07-05 10:44:47 +10:00
parent f2279ecadd
commit 7204844bcb
3 changed files with 19 additions and 15 deletions

View File

@ -76,6 +76,8 @@ export class CanvasInpaintMask {
if (this.drawingBuffer) {
if (this.drawingBuffer.type === 'brush_line') {
this.drawingBuffer.color = RGBA_RED;
} else if (this.drawingBuffer.type === 'rect_shape') {
this.drawingBuffer.color = RGBA_RED;
}
await this.renderObject(this.drawingBuffer, true);
@ -92,7 +94,7 @@ export class CanvasInpaintMask {
} else if (this.drawingBuffer.type === 'eraser_line') {
this.manager.stateApi.onEraserLineAdded2({ id: this.id, eraserLine: this.drawingBuffer }, 'inpaint_mask');
} else if (this.drawingBuffer.type === 'rect_shape') {
this.manager.stateApi.onRectShapeAdded2({ id: this.id, rectShape: this.drawingBuffer }, 'layer');
this.manager.stateApi.onRectShapeAdded2({ id: this.id, rectShape: this.drawingBuffer }, 'inpaint_mask');
}
this.setDrawingBuffer(null);
}

View File

@ -76,7 +76,10 @@ export class CanvasRegion {
if (this.drawingBuffer) {
if (this.drawingBuffer.type === 'brush_line') {
this.drawingBuffer.color = RGBA_RED;
} else if (this.drawingBuffer.type === 'rect_shape') {
this.drawingBuffer.color = RGBA_RED;
}
await this.renderObject(this.drawingBuffer, true);
this.updateGroup(true);
}
@ -91,7 +94,7 @@ export class CanvasRegion {
} else if (this.drawingBuffer.type === 'eraser_line') {
this.manager.stateApi.onEraserLineAdded2({ id: this.id, eraserLine: this.drawingBuffer }, 'regional_guidance');
} else if (this.drawingBuffer.type === 'rect_shape') {
this.manager.stateApi.onRectShapeAdded2({ id: this.id, rectShape: this.drawingBuffer }, 'layer');
this.manager.stateApi.onRectShapeAdded2({ id: this.id, rectShape: this.drawingBuffer }, 'regional_guidance');
}
this.setDrawingBuffer(null);
}

View File

@ -121,7 +121,6 @@ export class CanvasTool {
const currentFill = this.manager.stateApi.getCurrentFill();
const selectedEntity = this.manager.stateApi.getSelectedEntity();
const cursorPos = this.manager.stateApi.getLastCursorPos();
const lastMouseDownPos = this.manager.stateApi.getLastMouseDownPos();
const isDrawing = this.manager.stateApi.getIsDrawing();
const isMouseDown = this.manager.stateApi.getIsMouseDown();
@ -215,18 +214,18 @@ export class CanvasTool {
this.brush.group.visible(false);
this.eraser.group.visible(true);
// this.rect.group.visible(false);
// } else if (cursorPos && lastMouseDownPos && tool === 'rect') {
// this.rect.fillRect.setAttrs({
// x: Math.min(cursorPos.x, lastMouseDownPos.x),
// y: Math.min(cursorPos.y, lastMouseDownPos.y),
// width: Math.abs(cursorPos.x - lastMouseDownPos.x),
// height: Math.abs(cursorPos.y - lastMouseDownPos.y),
// fill: rgbaColorToString(currentFill),
// visible: true,
// });
// this.brush.group.visible(false);
// this.eraser.group.visible(false);
// this.rect.group.visible(true);
// } else if (cursorPos && lastMouseDownPos && tool === 'rect') {
// this.rect.fillRect.setAttrs({
// x: Math.min(cursorPos.x, lastMouseDownPos.x),
// y: Math.min(cursorPos.y, lastMouseDownPos.y),
// width: Math.abs(cursorPos.x - lastMouseDownPos.x),
// height: Math.abs(cursorPos.y - lastMouseDownPos.y),
// fill: rgbaColorToString(currentFill),
// visible: true,
// });
// this.brush.group.visible(false);
// this.eraser.group.visible(false);
// this.rect.group.visible(true);
} else {
this.brush.group.visible(false);
this.eraser.group.visible(false);