mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
tidy(ui): remove extraneous logging in CanvasStateApi
This commit is contained in:
parent
1c7ef827b6
commit
0556468518
@ -1,5 +1,4 @@
|
|||||||
import { $alt, $ctrl, $meta, $shift } from '@invoke-ai/ui-library';
|
import { $alt, $ctrl, $meta, $shift } from '@invoke-ai/ui-library';
|
||||||
import { logger } from 'app/logging/logger';
|
|
||||||
import type { AppStore } from 'app/store/store';
|
import type { AppStore } from 'app/store/store';
|
||||||
import type { CanvasLayerAdapter } from 'features/controlLayers/konva/CanvasLayerAdapter';
|
import type { CanvasLayerAdapter } from 'features/controlLayers/konva/CanvasLayerAdapter';
|
||||||
import type { CanvasManager } from 'features/controlLayers/konva/CanvasManager';
|
import type { CanvasManager } from 'features/controlLayers/konva/CanvasManager';
|
||||||
@ -78,8 +77,6 @@ type EntityStateAndAdapter =
|
|||||||
adapter: CanvasMaskAdapter;
|
adapter: CanvasMaskAdapter;
|
||||||
};
|
};
|
||||||
|
|
||||||
const log = logger('canvas');
|
|
||||||
|
|
||||||
export class CanvasStateApi {
|
export class CanvasStateApi {
|
||||||
_store: AppStore;
|
_store: AppStore;
|
||||||
manager: CanvasManager;
|
manager: CanvasManager;
|
||||||
@ -94,55 +91,42 @@ export class CanvasStateApi {
|
|||||||
return this._store.getState().canvasV2;
|
return this._store.getState().canvasV2;
|
||||||
};
|
};
|
||||||
resetEntity = (arg: EntityIdentifierPayload) => {
|
resetEntity = (arg: EntityIdentifierPayload) => {
|
||||||
log.trace(arg, 'Resetting entity');
|
|
||||||
this._store.dispatch(entityReset(arg));
|
this._store.dispatch(entityReset(arg));
|
||||||
};
|
};
|
||||||
setEntityPosition = (arg: EntityMovedPayload) => {
|
setEntityPosition = (arg: EntityMovedPayload) => {
|
||||||
log.trace(arg, 'Setting entity position');
|
|
||||||
this._store.dispatch(entityMoved(arg));
|
this._store.dispatch(entityMoved(arg));
|
||||||
};
|
};
|
||||||
addBrushLine = (arg: EntityBrushLineAddedPayload) => {
|
addBrushLine = (arg: EntityBrushLineAddedPayload) => {
|
||||||
log.trace(arg, 'Adding brush line');
|
|
||||||
this._store.dispatch(entityBrushLineAdded(arg));
|
this._store.dispatch(entityBrushLineAdded(arg));
|
||||||
};
|
};
|
||||||
addEraserLine = (arg: EntityEraserLineAddedPayload) => {
|
addEraserLine = (arg: EntityEraserLineAddedPayload) => {
|
||||||
log.trace(arg, 'Adding eraser line');
|
|
||||||
this._store.dispatch(entityEraserLineAdded(arg));
|
this._store.dispatch(entityEraserLineAdded(arg));
|
||||||
};
|
};
|
||||||
addRect = (arg: EntityRectAddedPayload) => {
|
addRect = (arg: EntityRectAddedPayload) => {
|
||||||
log.trace(arg, 'Adding rect');
|
|
||||||
this._store.dispatch(entityRectAdded(arg));
|
this._store.dispatch(entityRectAdded(arg));
|
||||||
};
|
};
|
||||||
rasterizeEntity = (arg: EntityRasterizedPayload) => {
|
rasterizeEntity = (arg: EntityRasterizedPayload) => {
|
||||||
log.trace(arg, 'Rasterizing entity');
|
|
||||||
this._store.dispatch(entityRasterized(arg));
|
this._store.dispatch(entityRasterized(arg));
|
||||||
};
|
};
|
||||||
compositeLayerRasterized = (arg: { imageName: string; rect: Rect }) => {
|
compositeLayerRasterized = (arg: { imageName: string; rect: Rect }) => {
|
||||||
log.trace(arg, 'Composite layer rasterized');
|
|
||||||
this._store.dispatch(rasterLayerCompositeRasterized(arg));
|
this._store.dispatch(rasterLayerCompositeRasterized(arg));
|
||||||
};
|
};
|
||||||
setSelectedEntity = (arg: EntityIdentifierPayload) => {
|
setSelectedEntity = (arg: EntityIdentifierPayload) => {
|
||||||
log.trace({ arg }, 'Setting selected entity');
|
|
||||||
this._store.dispatch(entitySelected(arg));
|
this._store.dispatch(entitySelected(arg));
|
||||||
};
|
};
|
||||||
setGenerationBbox = (bbox: Rect) => {
|
setGenerationBbox = (bbox: Rect) => {
|
||||||
log.trace({ bbox }, 'Setting generation bbox');
|
|
||||||
this._store.dispatch(bboxChanged(bbox));
|
this._store.dispatch(bboxChanged(bbox));
|
||||||
};
|
};
|
||||||
setBrushWidth = (width: number) => {
|
setBrushWidth = (width: number) => {
|
||||||
log.trace({ width }, 'Setting brush width');
|
|
||||||
this._store.dispatch(brushWidthChanged(width));
|
this._store.dispatch(brushWidthChanged(width));
|
||||||
};
|
};
|
||||||
setEraserWidth = (width: number) => {
|
setEraserWidth = (width: number) => {
|
||||||
log.trace({ width }, 'Setting eraser width');
|
|
||||||
this._store.dispatch(eraserWidthChanged(width));
|
this._store.dispatch(eraserWidthChanged(width));
|
||||||
};
|
};
|
||||||
setTool = (tool: Tool) => {
|
setTool = (tool: Tool) => {
|
||||||
log.trace({ tool }, 'Setting tool');
|
|
||||||
this._store.dispatch(toolChanged(tool));
|
this._store.dispatch(toolChanged(tool));
|
||||||
};
|
};
|
||||||
setToolBuffer = (toolBuffer: Tool | null) => {
|
setToolBuffer = (toolBuffer: Tool | null) => {
|
||||||
log.trace({ toolBuffer }, 'Setting tool buffer');
|
|
||||||
this._store.dispatch(toolBufferChanged(toolBuffer));
|
this._store.dispatch(toolBufferChanged(toolBuffer));
|
||||||
};
|
};
|
||||||
setFill = (fill: RgbaColor) => {
|
setFill = (fill: RgbaColor) => {
|
||||||
@ -240,8 +224,8 @@ export class CanvasStateApi {
|
|||||||
getBrushPreviewFill = (): RgbaColor => {
|
getBrushPreviewFill = (): RgbaColor => {
|
||||||
const selectedEntity = this.getSelectedEntity();
|
const selectedEntity = this.getSelectedEntity();
|
||||||
if (selectedEntity?.state.type === 'regional_guidance' || selectedEntity?.state.type === 'inpaint_mask') {
|
if (selectedEntity?.state.type === 'regional_guidance' || selectedEntity?.state.type === 'inpaint_mask') {
|
||||||
// The brush should use the mask opacity for these entity types
|
// The brush should use the mask opacity for these enktity types
|
||||||
return selectedEntity.state.fill.color;
|
return { ...selectedEntity.state.fill.color, a: 1 };
|
||||||
} else {
|
} else {
|
||||||
const state = this.getState();
|
const state = this.getState();
|
||||||
return state.tool.fill;
|
return state.tool.fill;
|
||||||
|
Loading…
Reference in New Issue
Block a user